<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Eliot Miranda wrote:
<blockquote
cite="mid:3ac5ce8a0803121358o78b49ceekc948657b48db627c@mail.gmail.com"
type="cite">.... in (I think) ObjectWorks 2.3 ParcPlace changed it to<br>
<div class="gmail_quote">
<div> #(nil true false foo) = (Array with: nil with: true with:
false with: #foo).<br>
<br>
Its generally more useful that way. I (and I suspect plenty of others)
find the extra #'s annoying noise that detracts from readablity. The
inconsistency is livable with since it is more convenient and there are
only three exceptions.<br>
</div>
</div>
</blockquote>
<br>
Three exceptions is lot, I think. Consider instead this way of
creating <br>
non-literal lists, or Arrays, with the "Association Syntax":<br>
<font face="Courier New"><br>
<b> nil -> true -> false -> #foo.</b></font><br>
<br>
This creates a tree of Associations - which really is a LINKED LIST! <br>
No special rules of evaluation, apart from standard ST-80 are required.<br>
<br>
<br>
<br>
The same pattern can be applied also to create "straight" Arrays <br>
or whatever data-structures on the fly. For instance we could define <br>
the method<b> #<-</b> for Object so that <br>
<br>
<font face="Courier New"><b>(nil <- true <- false <-
#foo) = <br>
(OrderedCollection with: nil with: true with: false with #foo) </b>.</font><br>
<br>
The difference between the left- and right side above<br>
is that<br>
1. "( nil <- true <- false <- #foo) " is shorter<br>
2. We can create Collections of arbitrary length this way: <br>
3. We can decide whether to use a variable or a literal for <br>
any part of the expression:<br>
<br>
#foo <- foo <- 123 <- nil <- "true" <- #false
<- #foo <- nil <- true <- false <- foo<br>
<br>
<br>
POINT: Smalltalk (-standard) does not <i>need</i> a syntax for
creating Arrays <br>
with non-literal elements. Why? Because BINARY OPERATORS can be <br>
utilized and redefined as needed to construct arbitrary data-structures.<br>
<br>
-Panu Viljamaa<br>
<br>
-- Utilize the Power of Smalltalk!<br>
<br>
<br>
</body>
</html>