[Newbies] Re: Squeak-specific syntax

nicolas cellier ncellier at ifrance.com
Wed Oct 29 22:16:39 UTC 2008


Mark Volkmann a écrit :
> I know that the syntax for literal and dynamic arrays is specific to 
> Squeak.
> Is the @ method in the Number class for creating Point objects specific 
> to Squeak?
> Is there any other syntax that is specific to Squeak?
> 
> ---
> Mark Volkmann
> 
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners

No @ is not specific. it was already a binary message in Smalltalk-80 
like + or * and should be found in every dialect.

Squeak has one major extension {1+1. 2*3.} for creating arrays
somehow equivalent to (Array with: 1+1 with: 2*3)

Plus the ability to use more than 2 binary characters to form a binary 
message, see implementors of ==>

Plus the ability to use left arrow as an assignment, which was the only 
assignment form in original st80, but that has been abandonned by 
"modern" implementation.
Unfortunately, in ASCII the leftArrow code correspond to the ugly 
underscore...


Squeak also has several documented and undocumented extensions about 
interpreting literals.

Example of extensions: reading a Float in another base than 10:
2r0.1e10
Note that the exponent is interpreted in base 10, not 2

One ugly example: doubling the minus sign
-10r-2

One ANSI recommended but not smalltalkish: separating minus sign and 
number with spaces:

- 2

note that it is interpreted differently in a literal array, one more 
reason i do not like it:
#( - 2 )

Some bizarre literal symbols which are not really documented and likely 
to fail in any other dialect:
##x
#12
#)
#.
#" i am a #x symbol "x
# x "me too"
#(#)# ) #()# :).
invent your own...

But in practice, i doubt anyone use such construct and write unportable 
code (not guaranteed to survive in next Compiler implementation).

Nicolas



More information about the Beginners mailing list