Subject: Re: make: :[] implementation
To: Alan Barrett <apb@cequrux.com>
From: Simon J. Gerraty <sjg@crufty.net>
List: tech-toolchain
Date: 09/24/2003 12:06:29
>On Tue, 23 Sep 2003, Simon J. Gerraty wrote:
>> I was originally going to remove the :tW and :tw modifiers since :[*]
>> and :[@] have the same effect, but for the little code they consume I
>> don't mind leaving them as is.  The W modifier for :C and :S is also
>> handy.

>I don't much like having :[0], :[*], :tW, :[@] and :tw as five ways of
>doing only two different things, but I don't know which of them to keep
>and which to remove.

Agreed - if we keep the :C and :S /W flag (which I think we should), 
then perhaps :tW is preferable as it is at least somewhat similar. 
At the same time :[0] is nice from an awk perspective ;-)
:[*] and :[@] make sense once you compare them to "$*" and "$@", but
I fear they will be confusing none the less.

>Both :[m..n] and :[n..m] are treated identically, so both :[2..-1] and
>:[-1..2] mean "everything from the second word to the last word".  If we
>ever plan to use syntax like this to reverse the order of words in the
>result (but if we don't implement that functionality just yet), then it
>might be a good idea to say that it's an error (for now) for the indices
>to be in the wrong order.

I plan to eventually handle reversing the order, so yes will make [-1..2]
an error for now.

Thanks
--sjg