From: "Andrej Borsenkow" <Andrej.Borsenkow@mow.siemens.ru>
To: <zsh-workers@sunsite.dk>
Subject: RE: named references
Date: Thu, 28 Jun 2001 12:07:43 +0400 [thread overview]
Message-ID: <000501c0ffa9$68c68350$21c9ca95@mow.siemens.ru> (raw)
In-Reply-To: <3B3A2D7A.7B8EA3AF@u.genie.co.uk>
This does not touch everything (I need some time to swallow the rest :-)
>
> > So I'd suggest adding to the union:
> > HashNode ref; /* value if declared nameref
> (PM_NAMEREF) */
>
> Using a pointer for the reference is something I considered when I
> started out. The problem is how to deal with references to unset
> parameters.
... and ...
>
> > I don't think that's necessary, but it raises the question of
> what really
> > happens when a reference-to-a-reference is made. That is:
> >
> > typeset v1 v2
> > typeset -n r1=v1
> > typeset -n r2=r1
> > typeset -n r1=v2
> >
> > At this point, is r2 still a reference to v1, or has it become
> a reference
> > to v2? That is, is r1 dereferenced at the time of assignment to r2, or
> > not until time of dereference of r2? This ...
>
> not until time of dereference of r2. r2 will be and will remain a
> reference to `r1' whatever r1 is whether that be unset, another
> reference, an array or scalar.
>
What happens in this case:
foo() {
typeset -n r=v
local v=foo
echo $r
}
v=bar
foo
I.e. does r refer to outer v ("by address" could you say) or to inner v ("by
name" would it be then)? The latter would be badly broken; but to implement
the former you must have reference to pm not the name.
-andrej
next prev parent reply other threads:[~2001-06-28 8:07 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-06-24 11:34 Oliver Kiddle
2001-06-24 18:28 ` Bart Schaefer
2001-06-27 19:01 ` Oliver Kiddle
2001-06-28 8:07 ` Andrej Borsenkow [this message]
2001-06-28 8:30 ` Bart Schaefer
2001-06-28 9:39 ` Peter Stephenson
2001-06-30 7:56 ` Bart Schaefer
2001-07-02 9:31 ` Peter Stephenson
2001-06-30 7:37 ` Bart Schaefer
2001-07-09 19:43 ` Oliver Kiddle
2001-06-25 5:19 ` Andrej Borsenkow
2001-06-27 16:03 ` Oliver Kiddle
2001-06-27 16:50 ` Peter Stephenson
2001-06-27 19:18 ` Oliver Kiddle
2001-06-30 8:09 ` Bart Schaefer
2001-06-27 17:14 ` Bart Schaefer
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='000501c0ffa9$68c68350$21c9ca95@mow.siemens.ru' \
--to=andrej.borsenkow@mow.siemens.ru \
--cc=zsh-workers@sunsite.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).