[Prev][Next][Index][Thread]

Re: how to make a vector of constants?



On Tue, 7 Mar 2000 12:30:05 -0500 (EST), "Michael T. Richter" <mtr@igs.net>
wrote:

> Hugh Greene <q@tardis.ed.ac.uk> wrote in message
> Pine.GSO.3.96.1000307170209.10480C-100000@tardis.tardis.ed.ac.uk">news:Pine.GSO.3.96.1000307170209.10480C-100000@tardis.tardis.ed.ac.uk...
> > Using "#[]" versus "vector()" is a bit of a Dylan gotcha and
> > should probably be in a FAQ somewhere.  Basically, only use "#[]" if
> > everything inside is a *literal* (not just a constant); otherwise use
> > "vector()".
> 
> This should definitely be in a FAQ somewhere.  I got tied down for two days
> tracking down this simple solution last year....  :-)

Dylan inherits this gotcha from Lisp:

ie	'(foo bar baz quux)		;; foo etc are not evaluated
vrs	(list foo bar baz quux)		;; foo etc _are_ evaluated

Lisp also has:

	`(,foo bar ,baz quux)		;; only foo and baz are evaluated

A difference between

	'(foo)	;; Lisp
and	#[bar]	;; Dylan

is that "foo" gets interned as a Lisp symbol while the Dylan example is
actually erroneous since "bar" is an identifier and doesn't get coerced to be
any kind of literal.

BTW I think that Keith Playford recently proposed that Dylan be changed so that
#[ ] evaluated its 'arguments'.

__Jason


References: