On Wed, Sep 21, 2011 at 03:07, Robert Shinka <k...@unknownlayer.net> wrote:

> In both fish-1.23.1 and the latest git, it does not work that way.
> > set var a b   c       d (echo e\ \ f\ng)
> > set | grep \^var
> var 'a'  'b  '  'c'  'd'  'e  f'  'g'
> > echo $var
> a b   c d e  f g
>

Then my fish indeed works differently from yours.
~/temp> cat fishtest.fish
set var a b   c    d (echo e\ \ f\ng)
set | grep \^var
~/temp> . fishtest.fish
var 'a'  'b'  'c'  'd'  'e  f'  'g'

I've attached the fishtest.fish to avoid mangling by mail programs. Does
that indeed give different output on your machine? I'm running git master,
commit id 157ca12. Version 1.23.1 (as tagged in git) works the same for me.



> It's not necessary to keep track of that whitespace, and I would rather
> fish didn't (including in the example I gave above, which is just odd).
>
> What I expect 'set' to do is store each element passed to it as a
> separate element in an array: the same way it does now, except for that
> oddity in argument parsing (which should probably be fixed, but I'm
> uncertain of the reason for it).
>
> Then, when expanding that array, offer two expansion forms: $var, which
> passes each element as a separate argument the way it does now, and
> "$var", which formats the contents into a single string, with each
> element separated from the next with a single \n character. In the case
> of output from a command, this could also be optimized to store the
> string directly, if desired, for a significant performance boost.
>
> Your 'myset' function would also work as expected given this behavior.
>

Ah, so you're not proposing that "$var" gives back the *original* string,
just that it joins the separate elements with \n instead of space.

I agree with you that the "$var" syntax where var is an array is not very
useful. At least I can't remember having used it with array variables. (I
have for one-element variables, but your proposal won't change anything for
those.) But I doubt your proposal will be that much of an improvement, once
the "(command)" syntax is implemented. Are there any uses for it that are
not covered by "(command)"?

Attachment: fishtest.fish
Description: Binary data

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to