Squeak and Objective-C (Re: I was wondering ...)

Marcel Weiher marcel at system.de
Wed Jun 23 16:41:05 UTC 1999


> From: Benjamin Pollack <foxtrot at travelin.com>
>
> I might be misunderstanding the issue here, but I'm wondering: is there 
> anything wrong with using the NSNumber class?  Conversion with  
that would
> be especially easy with [NSNumber numberWith[type]: aNumber], or  
even using
> the object-converter prefixes to a method that took an NSNumber.  This 
> would avoid the complicated modifications to gcc that you would be  
talking
> about.  Further, because you then have an NSNumber object, it should be 
> possible in that case to easily keep all Smalltalk parameters as an id, 
> i.e., permitting multiple types.  Would this work?

Yes it should work, it was the first alternative I mentioned  
(require everything to be objects).  However, then you have to bridge  
again to get the integer value into Squeak, because Squeak won't be  
able to do anything with the NSNumber.

However I think that conversion to SmallInteger (when possible) is  
preferable.  Squeak immediately has access to the value, and the  
conversion is fast + simple.

Adding SmallInteger arithmetic to gcc was not an entirely serious  
proposal, especially since some macros could do the job just as well  
for machine generated code.

Marcel





More information about the Squeak-dev mailing list