zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: BUG: zsh-3.1.5-pws-14: parameter expansion not working properly
Date: Thu, 15 Apr 1999 14:08:28 +0200 (MET DST)	[thread overview]
Message-ID: <199904151208.OAA08105@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: "Bart Schaefer"'s message of Thu, 15 Apr 1999 04:03:10 -0700


Bart Schaefer wrote:

> In what direction is the data flowing at this point?  Up or down the call
> stack?  I think you mean up; but paramsubst() is of course the caller of
> multsub() as well ...

I was slightly confused by this up/down thing, too. Again:

We have this call chain:

   A paramsubst(), calls
   B    multsub(), calls
   C       paramsubst()

Now, we could make the multsub() save (and at the end restore) the
value of, say `static int mult_isarr'. It then sets it to zero and
calls paramsubst() (via prefork(), as usual). At the end of
paramsubst() we set `mult_isarr = isarr'.

After the prefork(), multsub() now knows that the list it gets was an
array expression if `mult_isarr != 0'.

This was the first part of what I meant -- getting information about
the array'ness. With the other part I meant the call to multsub() we
are talking about here (line 980). There we have to decide if we give
`&aval' or `NULL' to multsub() where it is used to decide if the
joining should be done -- the problem to solve, as you said.

> Ideally, I think, it should still happen after, but the (non-)array-ness
> of whatever comes back from prefork() should be propagated up through
> isarr by multsub() -- which brings us back to the static global.

And this is what I meant (I just think less in terms of `isarr' then
in terms of `aval' -- and deciding when to give it to multsub()).

> No, that's too confusing and not necessary.  The only real issue is the
> "precedence" if you will, of subscripting vs. joining.  We "solved" the
> problem of subscripting scalars that were accidentally treated as arrays,
> by forcing all quoted arrays to be taken as scalars; I think we need to
> back off from that and concentrate on not accidentally treating scalars
> as arrays.

I don't think I understand this. And I thought I kept it from arrays
being accidentally being treated as scalars.

>From your first mail about this I got the impression that you wanted
nested expressions to keep their knowledge about whether they are
arrays or not, so that (with foo being an array) in "${${${${(@)foo}}}[1]}"
the outer paramsubst() (A) gets notified by multsub() (B) that the
inner paramsubst() (C) returned an array and the subscripting gives
the first array element. This `notification' would be done by having
multsub() use `&aval' instead of `&val' and by setting `*isarr', of
course.
With respect to the outer paramsubst()s this would make things
independent of whether the whole thing is in quotes or not, only the
inner paramsubst()s `control' if the outer ones work on an array
by testing if the thing is in quotes and if the `(@)' flag (or
something similar like the `s' flag or `=') is used.

Hope this makes it clearer.

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


             reply	other threads:[~1999-04-15 12:08 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-04-15 12:08 Sven Wischnowsky [this message]
1999-04-15 20:10 ` Bart Schaefer
  -- strict thread matches above, loose matches on Subject: below --
1999-05-10  9:13 Sven Wischnowsky
1999-04-16  7:36 Sven Wischnowsky
1999-04-16  7:48 ` Andrej Borsenkow
1999-04-16  9:04   ` Bart Schaefer
1999-04-16  9:26     ` Andrej Borsenkow
1999-04-18 23:39 ` Bart Schaefer
1999-05-07 11:51 ` Peter Stephenson
1999-05-07 13:36   ` Sven Wischnowsky
1999-05-09 17:49     ` Bart Schaefer
1999-04-15  6:49 Sven Wischnowsky
1999-04-15 11:03 ` Bart Schaefer
1999-04-12  7:17 Sven Wischnowsky
1999-04-14 17:27 ` Bart Schaefer
1999-04-10 11:28 Geoff Wing

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199904151208.OAA08105@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).