zsh-workers
 help / color / mirror / code / Atom feed
* zsh3.0.0 bug: $=a split
@ 1996-08-16 23:02 Huy Le
  1996-08-16 23:34 ` Zefram
  0 siblings, 1 reply; 4+ messages in thread
From: Huy Le @ 1996-08-16 23:02 UTC (permalink / raw)
  To: zsh-workers

why do these print out the same thing all of a sudden?

wrath% a="1 2 3"
wrath% i=$a
wrath% echo $i[2],$i[3]
 ,2
wrath% i=$=a
wrath% echo $i[2],$i[3]
 ,2
wrath% i=$==a
wrath% echo $i[2],$i[3]
 ,2

This is on HPUX9 and IRIX5.

    -Huy


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: zsh3.0.0 bug: $=a split
  1996-08-16 23:02 zsh3.0.0 bug: $=a split Huy Le
@ 1996-08-16 23:34 ` Zefram
  0 siblings, 0 replies; 4+ messages in thread
From: Zefram @ 1996-08-16 23:34 UTC (permalink / raw)
  To: Huy Le; +Cc: zsh-workers

>why do these print out the same thing all of a sudden?
>
>wrath% i=$a
>wrath% i=$=a
>wrath% i=$==a

Because they mean the same thing?  Field splitting is never performed
on the RHS of a scalar assignment.

-zefram


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: zsh3.0.0 bug: $=a split
  1996-08-16 23:52 ` Zefram
@ 1996-08-21 18:35   ` Zoltan Hidvegi
  0 siblings, 0 replies; 4+ messages in thread
From: Zoltan Hidvegi @ 1996-08-21 18:35 UTC (permalink / raw)
  To: Zefram; +Cc: huyle, zsh-workers

[I'm back earlier than I promised but do not expect too much from me in the
 next two days... :-) ]

Zefram wrote:
> >Now, I need the parentheses or need to declare i as an array, but
> >before i would automatically be set to an array:
> 
> That's mentioned about two pages down Etc/NEWS, but in the context of
> globbing.  Globbing in assignments can be turned on with GLOB_ASSIGN,
> but there's no option to do field splitting to generate an array.
> You'll just have to use parentheses, which works with older zsh
> versions anyway.
> 
> Zoltan: should GLOB_ASSIGN be extended to generate arrays based on
> field splitting too?  Or do we now want to remove this option
> entirely?

I do not like GLOB_ASSIGN and I really feel that it should be completely
removed.  Zsh-2.5.0 handled such situations much worse than 3.0.0.  If foo
was an array with zero or one elements, after a

foo=$foo

assignment it changed to a scalar.  Otherwise it remaned an array.  After

foo=*

foo was array if * expanded to more than 1 files otherwise foo become a
scalar.  That piece of code which did that also caused `ambiguous' error
message from zsh in some other situations (I could not tell now any but
that may happen every time singsubst() is called).

In an assignment,

foo=$bar

it may seem to be logical for foo to become an array if bar is an array but
what should happen if I write foo=/$bar?  Internally the RHS is evaluated
and after that it is not possible to tell if the result came from an array
expansion or word splitting or globbing etc.  glob_assign only enables
globbing after the other expansions.  The other expansions will still
produce a single word.

Zoltan


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: zsh3.0.0 bug: $=a split
       [not found] <199608162344.QAA02058@envy.ugcs.caltech.edu>
@ 1996-08-16 23:52 ` Zefram
  1996-08-21 18:35   ` Zoltan Hidvegi
  0 siblings, 1 reply; 4+ messages in thread
From: Zefram @ 1996-08-16 23:52 UTC (permalink / raw)
  To: Huy Le; +Cc: Z Shell workers mailing list

>Now, I need the parentheses or need to declare i as an array, but
>before i would automatically be set to an array:

That's mentioned about two pages down Etc/NEWS, but in the context of
globbing.  Globbing in assignments can be turned on with GLOB_ASSIGN,
but there's no option to do field splitting to generate an array.
You'll just have to use parentheses, which works with older zsh
versions anyway.

Zoltan: should GLOB_ASSIGN be extended to generate arrays based on
field splitting too?  Or do we now want to remove this option
entirely?


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1996-08-22  3:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-08-16 23:02 zsh3.0.0 bug: $=a split Huy Le
1996-08-16 23:34 ` Zefram
     [not found] <199608162344.QAA02058@envy.ugcs.caltech.edu>
1996-08-16 23:52 ` Zefram
1996-08-21 18:35   ` Zoltan Hidvegi

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).