[squeak-dev] [Question] nil, true, false in array literals

James Foster Smalltalk at JGFoster.net
Wed Dec 3 10:46:07 UTC 2008


Igor,

What would you expect from the following: #(1)? Should it be (Array  
with: 1) or (Array with: #'1')?

I think that the assumption is that you should be able to include any  
literal constant (including SmallIntegers) in a literal constant  
array. I think of #(foo) as a shortcut for #(#'foo'), where the second  
form is more explicit. If you want to avoid the ambiguity, then always  
be explicit when you want a symbol.

James

On Dec 3, 2008, at 11:01 AM, Igor Stasenko wrote:

> in squeak, there is one assymetry in handling names, when used in
> array literals:
>
> #(true false nil foo)  = (Array with: true with: false with: nil  
> with: #foo)
>
> instead of:
>
> #(true false nil foo)  = (Array with: #true with: #false with: #nil  
> with: #foo)
>
> i wonder, is such parse rules standartized or belongs only to squeak?
>
> What is correct behavior, you think is?
>
> -- 
> Best regards,
> Igor Stasenko AKA sig.
>
>




More information about the Squeak-dev mailing list