Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #11382

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

From Chet Ramey <chet.ramey@case.edu>
Newsgroups gnu.bash.bug
Subject Re: Parameter Expansion: Case Modification: ${var~} not documented
Date 2015-08-18 16:50 -0400
Message-ID <mailman.8571.1439931052.904.bug-bash@gnu.org> (permalink)
References <CAO9HFd=EKGJ3KpuJtOcfWTn2F88ZFs=RUjjA9YF_rwJE9HY=gw@mail.gmail.com> <55D34377.9010305@case.edu> <CAO9HFdn4-e9-MSZWsYyPzArCUKuATfr3Xp7wj_WBKh9O-_V9AQ@mail.gmail.com> <3059638.V9nJ3FgFh1@smorgbox>

Show all headers | View raw


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 ${param@operator} 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 `!var[@]` 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 ${!param[@]/followed/bysomething}
and ${!param[@]}.  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 (param[@]) as the
unit of  indirection instead of just the name (param).

Chet



-- 
``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/

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: Parameter Expansion: Case Modification: ${var~} not documented Chet Ramey <chet.ramey@case.edu> - 2015-08-18 16:50 -0400

csiph-web