Quantcast
Channel: Sam Phillips's blog
Viewing all articles
Browse latest Browse all 3

Symbol >> #numArgs

$
0
0

I have been working on and off for the past couple of years on a Prototype Object language (called Twain) similar to Self in my spare time. I have developed about a dozen partial implementation in Haskell, Scheme, Squeak, Visual Works, GST, Python, C, etc.

The most recent of these has been an interpreter in GST. Since there are a lot of similarities between Smalltalk and my target language, and openness of the class Smalltalk language, I've been able to piggy back on many of the standard Smalltalk classes for the primitive data types.

In particular I've been reusing Symbols as message selectors and using the numArgs method for arity checking. In Twain primitive messages start with the underscore. With numArgs this causes a problem though.


In GST:
st> #_newArgs:Lits:Insts: numArgs
1

VisualWorks:
#_newArgs:Lits:Insts: numArgs
3

Squeak (Squeak's reader cannot handle the leading _ in a regular symbol, thus the quotes):
#'_newArgs:Lits:Insts:' numArgs  
-1

ANSI ST does not specify the behavior of this method, but who is the most correct? VW seems to be doing what I would expect, but I could see valid reasons for the others as well.


Viewing all articles
Browse latest Browse all 3

Trending Articles