[Top][All Lists]

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

Re: Parameter Expansion: Case Modification: ${var~} not documented

From: Chet Ramey
Subject: Re: Parameter Expansion: Case Modification: ${var~} not documented
Date: Tue, 18 Aug 2015 16:50:38 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.0.1

On 8/18/15 1:43 PM, Dan Douglas wrote:
> On Tuesday, August 18, 2015 9:54:55 AM CDT Isaac Good wrote:
>> Would you mind sharing the rational behind having it undocumented?
> Since I like guessing: the syntax for parameter expansion operators is 
> currently non-extensible, so the namespace of terse operators is in limited 
> supply. New syntax should be extensible to suit future needs while keeping 
> the 
> language minimal. This is new syntax that adds one function that will be 
> rarely used. I can think of better ways to use that operator.

This is true, and I would prefer to not set the ~ `operator' in stone until
I'm more satisfied with how it works.

Bash-4.4 has the address@hidden family of expansions (inspired by a
similar feature in mksh) as the extensible syntax you're asking for.

> The operators in use currently are already a disaster. We *really* could use 
> a 
> solution for the circumfix operators address@hidden and `!var[*]` that 
> collide with 
> the prefix `!` operator, and for reasons unknown don't interoperate with any 
> of the other expansions such as array slicing / subscripting. I wouldn't want 
> to add new (pointless) syntax before the fundamental problems are addressed.

I assume you mean the difference betweeen address@hidden/followed/bysomething}
and address@hidden  The latter I picked up from ksh93 as is.  The former is
the generalization of indirect evaluation I sort of picked up from ksh93,
because I didn't think you needed namerefs to have indirect evaluation.
The first examples doesn't work as well as I hoped it would because I
chose to use the `parameter' as used in other expansions (address@hidden) as the
unit of  indirection instead of just the name (param).


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

reply via email to

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