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    c...@case.edu    http://cnswww.cns.cwru.edu/~chet/

Reply via email to