bug-bash
[Top][All Lists]
Advanced

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

Re: minor language RFE(s)


From: Chet Ramey
Subject: Re: minor language RFE(s)
Date: Thu, 8 Oct 2015 11:44:17 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 10/7/15 7:38 PM, Linda Walsh wrote:

> I was thinking ... lets say we had 1 or 2 abbreviation
> keywords, at least 1 being "int=declare -i",
> and ease-of-use "my=declare"
> 
> that could then allow the "declare" of the 'for' iterator
> as local, in-line.
> 
> i.e. instead of predeclaring them w/'declare -i' or 'declare'
> one could write:
> 
>   for((int i=0; i<10; ++i)); do : done
> 
> or 2)
> 
>   for int i in {1..10}; do : done
>   for my i in {a..z}; do : done

These change the syntax of the shell in incompatible ways.  The
arithetic `for' command takes arithmetic expressions, not shell
commands, and the `for' command takes a name (identifier), not a
shell command.  Aside from any syntactic sugar (`int', `my'), these
are not consistent with how the shell grammar is formed, and this
isn't a good enough reason to change the grammar that dramatically.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]