[#1816] Ruby 1.5.3 under Tru64 (Alpha)? — Clemens Hintze <clemens.hintze@...>

Hi all,

17 messages 2000/03/14

[#1989] English Ruby/Gtk Tutorial? — schneik@...

18 messages 2000/03/17

[#2241] setter() for local variables — ts <decoux@...>

18 messages 2000/03/29

[ruby-talk:01890] Re: object creation

From: matz@... (Yukihiro Matsumoto)
Date: 2000-03-16 15:35:31 UTC
List: ruby-talk #1890
Hi,

In message "[ruby-talk:01874] object creation"
    on 00/03/15, Andrew Hunt <Andy@Toolshed.Com> writes:

|Just a quick question -- is the following sequence the correct
|way to create a Ruby object from C?
|
|  NEWOBJ(obj, c-type)  -- allocate memory for an object
|  OBJSETUP(obj, class, T_class); -- set appropriate flags
|  rb_obj_call_init(obj, argc, argv); -- call initialize

Yes.  But I think it's better for T_DATA object to use
Data_Make_Struct/Data_Wrap_Struct, as Clemens stated.

|There was some discussion a while back on whether *every* class called 
|initialize or not, how did that end up?  It would apper from the
|current code that most of the built-in classes *do not* call
|an initialize method.

I made several classes to call `initialize', such as Array, Range,
Dir, etc.  But still wondering whether *every* class calls `initialize'
or not, for cases the arguments to `new' used for allocation.

							matz.

In This Thread

Prev Next