[squeak-dev] Re: [Pharo-project] Alien FFI
nicolas cellier
ncellier at ifrance.com
Mon Nov 24 22:07:26 UTC 2008
Andreas Raab a écrit :
> 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
>
>
I tend to agree.
However, the case you submit is already handled as:
'foo' asWideString asAlien.
See http://wiki.squeak.org/squeak/uploads/6100/Alien%20FFI.pdf.
More information about the Squeak-dev
mailing list
|