Primitive SmallInt checks automated (was Re: (Issues with) how
Slate VM primitives work)
Brian Rice
water at tunes.org
Mon Mar 20 13:34:12 PST 2006
I've successfully built a VM which transparently generates ASSERT
calls for primitive methods that dispatch on SmallIntegerProto or
SmallIntegerTraits. That means that the VM will still die for now if
"4 + SmallInteger" is given, but it's a short step from this to
signaling #primitiveError (maybe #primitiveTypeTagError) instead, and
also to fix up the remaining ways in which this checking is done.
At least, I think so. I need to test it some more and vary the
pidginPrimitive changes enough to know for sure how sound it is.
On Mar 18, 2006, at 11:38 AM, Brian Rice wrote:
> #isSmallInt checking is also still a good idea, probably based on
> the usage of SmallIntegerProto and SmallIntegerTraits in
> `pidginPrimitive method role annotations. Probably #primitiveError
> would be sufficient to make this work effectively rather than a
> separate #integerExpected signal message. Right now, for example,
> the VM has a crashing bug for the use of the SmallInteger
> "prototype" (no cloning, so it's not really a prototype at all) or
> traits object in any math primitives. So, this is high priority, at
> least to get basic checks in.
>
> Overriding the ASSERT() macro (which pidgin #assert: translates to)
> to call #primitiveError might be worthwhile. Either that or making
> a different selector #failIf: or something.
>
> On Mar 12, 2006, at 8:30 PM, Brian Rice wrote:
>
>> This is just a general list of recent thoughts.
>>
>> So, I see some problems with VM primitives as-is:
>> - `pidginPrimitive does not allow for quick checking of isSmallInt
>> based on the definition which means the method body has to do it.
>> This could be changed to read/manipulate the dispatch in the
>> signature, haven't done it yet. Type-dispatch in the signature is
>> not allowed in Slate grammar yet, but would be the more
>> appropriate means; either that or I force usage of the method header.
>> - Errors must be signaled with selectors that the image responds
>> to, which means an entry in the linkage table. Generic
>> "primitiveError"s are not that much better, but for very simple
>> things it's more appropriate to not have the VM try to be smart.
>> In any case, that may be the solution.
--
-Brian
http://tunes.org/~water/brice.vcf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
Url : /archives/slate/attachments/20060320/f341f880/PGP.pgp
More information about the Slate
mailing list