Smalltalk Syntax (was: Re: Re: First pass for generic DSM)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Smalltalk Syntax (was: Re: Re: First pass for generic DSM)

Lukas Renggli
>> dSMMatrix := DSMMatrix withNodes: #(#1 #2 #3) edges: #(#(#1 #2) #(#2 #1)
>> #(#3 #1)).

Just as a side remark, but I already stumbled several times over code
like the above in Mondrian and Glamour:

   #1           " is not valid Smalltalk "

It does not parse with any parser other then the default one in
Pharo/Squeak. Up until a few minutes ago it broke the refactoring
engine badly. Pharo strangely compiles the above expression to the
number 1. So why not just put the number, which also saves you one
character?

   1             " is a valid number "

To get a symbol with 1 you need to put the number in quotes:

   #'1'          " is a valid symbol "

Lukas

--
Lukas Renggli
www.lukas-renggli.ch
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Smalltalk Syntax (was: Re: Re: First pass for generic DSM)

Simon Denier-3

On 21 avr. 2010, at 16:25, Lukas Renggli wrote:

>>> dSMMatrix := DSMMatrix withNodes: #(#1 #2 #3) edges: #(#(#1 #2) #(#2 #1)
>>> #(#3 #1)).
>
> Just as a side remark, but I already stumbled several times over code
> like the above in Mondrian and Glamour:
>
>   #1           " is not valid Smalltalk "


Good remark. I always wonder why people (feel obliged to?) put only symbols inside of literal arrays, when the following works and is more readable:

dSMMatrix := DSMMatrix withNodes: #(1 2 3) edges: #((1 2) (2 1) (3 1)).


>
> It does not parse with any parser other then the default one in
> Pharo/Squeak. Up until a few minutes ago it broke the refactoring
> engine badly. Pharo strangely compiles the above expression to the
> number 1. So why not just put the number, which also saves you one
> character?
>
>   1             " is a valid number "
>
> To get a symbol with 1 you need to put the number in quotes:
>
>   #'1'          " is a valid symbol "
>
> Lukas
>
> --
> Lukas Renggli
> www.lukas-renggli.ch
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

--
 Simon




_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Smalltalk Syntax (was: Re: Re: First pass for generic DSM)

Alexandre Bergel
In reply to this post by Lukas Renggli
>>> dSMMatrix := DSMMatrix withNodes: #(#1 #2 #3) edges: #(#(#1 #2)  
>>> #(#2 #1)
>>> #(#3 #1)).
>
> Just as a side remark, but I already stumbled several times over code
> like the above in Mondrian and Glamour:

I tried to find some #0, #1, ... in Mondrian, but I haven't found some.

Cheers,
Alexandre
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.





_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Smalltalk Syntax (was: Re: Re: First pass for generic DSM)

Lukas Renggli
>>>> dSMMatrix := DSMMatrix withNodes: #(#1 #2 #3) edges: #(#(#1 #2) #(#2 #1)
>>>> #(#3 #1)).
>>
>> Just as a side remark, but I already stumbled several times over code
>> like the above in Mondrian and Glamour:
>
> I tried to find some #0, #1, ... in Mondrian, but I haven't found some.

Indeed, there are no occurrences in the latest Moose distribution.

There is only one in Glamour, but I think this is already fixed in the
latest version.

Lukas

--
Lukas Renggli
www.lukas-renggli.ch
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev