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

Re: subscripting



On 5 September 1994, goon wrote
> admittedly this probablly isn't going to come up very often, but this behavior
> seems to be a little inconsistent:
> 
> ; fu = (a b c d e)
> ; echo $fu(2 2)
> b b
> ; echo $fu(2 ... 2 ...)
> bad subscript: ...
> ; echo $fu(2 ...)
> b c d e

The problem is that (2 ... 2 ...) is parsed as (2 ... 2) followed by ...
alone, and the latter is a syntax error.  There is no way to get the
behavior you want in one subscript.  Use ``$fu(2 ...) $fu(2 ...)''

> straining @ gnats? ... anyway. i thought perhaps that $fu(2- 2-) might be 
> better syntax? (and, of course $fu(2-5 2-5) ...

Perhaps - instead of ... would be reasonable.  I don't have any memory
of why we picked ..., but it was a decision made in ``hs,'' an es/rc
hybrid I hacked up as a prototype a year before we really began to work
on es.

As far as making the subscript elements separate words versus one word
with deeper syntax, I hadn't considered the alternative.  It's certainly
easier to do it this way.  Your proposed syntax would make it possible
to have two open-ended subscript sequences in one subscript reference,
which is nice, if minor, improvement.

Paul