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

Re: Simple Reader Macros for Dylan



In article <9E8+OOavNCObCTfqrV8BpYiBGPgZ@4ax.com>, Jason Trenouth
<jason@harlequin.co.uk> wrote:

> > Uh, Perl already did that.
> > 
> > [bruce@hp bruce]$ perl -e '($x = "hello there") =~ s(lo)[zz]; print "$x\n"'
> > helzz there
> 
> Okay great. So what about it?

So do it, I guess, and let us know how it works out.

I'd suggest not allowing *quite* the full generality of Perl's syntax. 
Allowing multiple arguments to be specified would be useful (e.g. as in
the s/// example above).  But you could restrict the allowable single
delimiters to maybe /,\,!, and |.  Having the pairs be ",',{},(),[],<>
seems ok as all those are used in Dylan anyway.

I really hope that Dylan doens't become a kitchen-sink language, but
extendable literals doesn't seem like the straw that will break the
camel's back, and it might forstall a bunch of others, such as a special
literal format for complex numbers, or for dates, or whatever.  Of course
everyone proposing an extension to any language *always* says that... :-)

But if the function that processes the literal is written so as to not
modify global state then we're even likely to see it optomised out by a
suitably smart compiler.

-- Bruce



References: