<br><br><div class="gmail_quote">2011/5/31 <a href="mailto:info@tomsik.cz">info@tomsik.cz</a> <span dir="ltr">&lt;<a href="mailto:info@tomsik.cz">info@tomsik.cz</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Sorry, I forgot about uselessness of array literals.<br>
<br>
I simply don&#39;t see any use-case in which I&#39;d like to<br>
evaluate something in compile-time, it&#39;s feels to me<br>
like another form of static state.<br>
<br>
Are there any (major) advantages of array literals?<br>
Something which couldn&#39;t be done without them?<br></blockquote><div><br></div><div>I remember anecdotes from the last decade on slow start-up of Java applications that were either competing with VisualWorks or had been ported from VisualWorks that in part were due to the lack of powerful literal facilities in Java.  It appears that having the ability to define complex data statically without having to construct it by running code is a significant space and time saver (space, since the code to construct a complex literal will almost certainly be bulkier than that literal unless the code is sophisticated enough to be functioning like a decompressor, in which case it&#39;ll likely be incomprehensible too).  For me, a string literal syntax is an essential component of a good programming language and Smalltalk excels here.</div>
<div><br></div><div>There /is/ an issue as to whether #() is necessary syntax.  After all one could rely on the compiler to detect whether a { expr. expr } form can be evaluated at compile time.  That&#39;s a position Gilad Bracha has taken in Newspeak, and I think that design is driven by modularity concerns (in Newspeak there is a desire for the class of literals to eventually be determined at module instantiation time, based on what classes one imports, not on compile time).  While this is a good argument in Newspeak it strikes me as very bad for readability.  Using an easily recognised literal form takes significant cognitive load off of the programmer and that&#39;s extremely important (and fits with Smalltalk&#39;s ethos).</div>
<div><br></div><div>2¢</div><div>Eliot</div></div><br>