Project

General

Profile

Actions

Feature #19757

closed

Add new C API to create a subclass of `Data`

Added by nobu (Nobuyoshi Nakada) about 1 year ago. Updated about 1 year ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:114088]

Description

I propose a C API rb_data_define which crates a subclass of Data.

/**
 * Defines an anonymous data class.
 *
 * @endinternal
 *
 * @param[in]  super           Superclass  of the  defining  class.   Must be  a
 *                             descendant of ::rb_cData, or 0 as ::rb_cData.
 * @param[in]  ...             Arbitrary number of  `const char*`, terminated by
 *                             NULL.  Each of which are the name of fields.
 * @exception  rb_eArgError    Duplicated field name.
 * @return     The defined class.
 */
VALUE rb_data_define(VALUE super, ...);

Updated by Eregon (Benoit Daloze) about 1 year ago

Why not just using rb_funcall()?

Actions #2

Updated by nobu (Nobuyoshi Nakada) about 1 year ago

  • Status changed from Open to Closed

Applied in changeset git|9c1fe9064c56cef3bde856d7fa1f907195af1003.


[Feature #19757] Add new API rb_data_define

Actions

Also available in: Atom PDF

Like0
Like0Like0