Method names
Matthew McDonald
mafm at cs.uwa.edu.au
Mon Nov 2 05:37:47 UTC 1998
Andreas Raab writes:
> > Messages usually have the arguments last. Wouldn't it be nice to have
> > messages that could have arguments between a phrase?
> No.
[...]
> > aBitStream next: 40 bits
[...]
> The above should be written as
>
> aBitStream next: 40 "bits"
I thought the trailing no-op in the message selector was a nice idea.
Comments aren't as good as the message selector syntax. Comments get
out of date and people leave them out. If it's really worth mentioning
in a comment, that you're expecting with 40 _bits_, then it's worth
making this explict/mandatory using the method selector.
Also, the trailing no-op in the method-selector allows you to have a
similar method you invoke like this:
aBitStream next: 40 bytes.
It looks like the main difficulty would be that the resulting language
couldn't be parsed without extra information - you'd need to know
whether or not there was a message called #next:bits to decide whether
or not "aBitStream next: 40 bits" meant ((aBitStream next: 40) bits).
--
Matthew McDonald <mafm at cs.uwa.edu.au>
More information about the Squeak-dev
mailing list
|