[squeak-dev] Compiling {} statically?

Bert Freudenberg bert at freudenbergs.de
Tue Nov 24 10:51:03 UTC 2009


On 24.11.2009, at 10:51, Andreas Raab wrote:
> 
> Hi -
> 
> Here is a question: Does anyone know how much effort it would be to compile the brace array construct down to a literal array if it only contains static elements? This would allow us to use {} consistently even in places where we'd otherwise use #(). I'm not sure if it's worth it but I dislike the asymmetry in literal arrays that symbols aren't prefixed by #symbol and if we'd be able to compile {} statically where that's possible we could completely and consistently replace all uses of #() by {}.
> 
> Thoughts?

Well you can actually #symbol notation in #() too. It's just optional.

OTOH I have seen newbies use {} exclusively, apparently unaware of #(). It's an odd construct for sure. Just too convenient to kick out.

But I don't think changing the semantics of {} is a good idea. It is just syntactic sugar for array construction at runtime. Or would you suggest to compile "Array with: 42" statically too? ;)

- Bert -





More information about the Squeak-dev mailing list