The ## syntax that some Smalltalks have (Smalltalk/X, for
example, which calls it a Dolphin extension) is related
to Common Lisp's
   #.e      the result of evaluating e at *read* time,
            taken as a literal
   #,e      the result of evaluating e at *load* time,
            taken as a literal.
This reminds us there are several times that a ## form
could be evaluated:
 - in the parser, when a method is parsed (before code
   generation)
 - when code is generated
 - when code is generated AND whenever the image is
   restored
 - when the value is first needed (I'd prefer this)
 - when the value is first needed in a thread (that
   is, each thread that encounters it will evaluate
   it just once, so each thread may see a different
   value).

One continuing annoyance in Smalltalk is that I cannot
put a Fraction, a Date, a Time, or a DateAndTime in a
literal.  It would be nice to have #1969-07-20 or #1/2
or #16:40:32 as literals and they contain no expressions
that could result in any confusion about when they are
evaluated and cannot be changed any more than a character
literal can.

Curly brace syntax {e1. ... en} is an expression form,
not a literal form.  Similar forms for sets of several
kinds and dictionaries of several kinds are supported
in my Smalltalk, and they are indeed useful, but they
are especially useful because they are *not* literals
but create new values every time.


On 28 April 2018 at 16:13, lb <liangbin...@126.com> wrote:

> Hi,
> I think the question is
> How automaticly create literal's objects , not initialize.
> e.g
> 'aString'
> #aSymbol
> { anArray}
> #[]
> ............
>
> Cheers  Liang
>
>

Reply via email to