On Mar 19, 2008, at 3:36 PM, Benjamin Stiglitz wrote:
Also, Ben and I have been brainstorming on Monday about future changes, and here is what we decided:
http://trac.macosforge.org/projects/ruby/wiki/MacRubyBrainstorming
These seem to all be Hash class related. Is there something which encompasses more of the big-picture brainstorming for MacRuby as a whole?
There are a few other high-level directions in there, regarding Number, Symbol, Nil/False/TrueClass, and Object. Laurent, I guess you need to dump the rest of your brain there, though…
In fact these are already part of the braindump I think :) But it's not relatively intuitive I admit.
Hash primitives should rb_funcall if the receiver is a subclass of Hash.
So that you can subclass Hash, override #[], and CFDictionary/ NSDictionary APIs should call your own implementation instead. (Same for Array and String.)
Freezing an object should store a flag that should be checked in the primitive methods and appropriately raise an exception.
So that when Objective-C tries to modify a Hash that was frozen in Ruby, an exception would be raised in the Objective-C side. (Same for Array and String.)
Symbols should be objects (flagged String) as they are actually represented in parse.y, and passed as they are in Objective-C. Incoming symbol objects should be recognized by the flag.
Currently in the core, symbols are pointer-like types and not real objects. The idea is to use a real object class instead (based on String), so that it can be passed to Objective-C without conversion.
All Ruby integers should be NSNumbers. Bignum is a custom subclass of NSNumber which implements the primitive methods. MacRuby should unique most numbers.
As symbols, fixnums in the core are not real objects but pointer-like types. The idea is to use CFNumbers instead and unique most of them (if not all?). Float and Bignum would be subclasses of CFNumber too, and incoming pure CFNumbers would be appropriately identified as Float by looking at the type.
Should we change the way Qtrue/Qfalse/Qnil are represented?
That's a pending issue. Qtrue, Qfalse and Qnil in the core are magic constants (respectively 2, 0 and 3). We cannot simply pass them to Objective-C as objects. Laurent