[squeak-dev] Re: [Pharo-project] Alien FFI

Andreas Raab andreas.raab at gmx.de
Mon Nov 24 22:02:46 UTC 2008


Vassili Bykov wrote:
> Apart from the C semantics, this is also a questionable style. The
> general rule for the choice between instance creation or conversion
> messages is that conversion messages make sense when the classes are
> sufficiently similar. An Alien is not an alternative form of a String,
> and "'foo' asAlien" is not a conversion of a String to an Alien. It's
> a creation of an Alien initialized in a particular way. There could be
> other equally meaningful ways of initializing it from the same data,
> so "Alien newCString: 'foo'" works because we could also have "Alien
> newUnicodeString: 'foo'", and "'foo' asAlien" is a convenience that
> doesn't scale (and also makes aliens appear less alien than they ought
> to).

+1

Cheers,
   - Andreas



More information about the Squeak-dev mailing list