in reply to Comprehending Binary :=

Hi swifttone,

(which I'm not sure I get: Can't I do (@a , @b) = (@b, @a) now that lists either are or are not flattened?)

Nope. Not according to Exegesis and comments made in the thread Apocalypse 3. According to those comments the slurp behaviour of = hasn't changed.

What is the scope of an alias?

Good question. I'd like to know that too.

Am I not understanding what an alias is? How is $bound := %data{$key} different than $bound = \%data{$key}

Well, lets say %data{$key}="Foo", then in the first case $bound would also equal "Foo", but in the second case $bound would be refrence to the string "Foo" and thus to get at the string would be $$bound="Foo". There were more intuitive examples in Exegesis, like @bound := %data{$key} which would make @bound be an aliase for the array that %data{$key} refrences.

Would $bound := %data{$key} give me a different $bound as $key changed?

Judging by the fact that TheDamian mentioned using aliases as a form of the Pascal/Basic with sturcture, (Yahh!) I would assume so. Which I guess basically answers the earlier question regarding scoping issues, ie that an alias would have to be a scoped entity, but frankly if it is scoped then there are going to be some weird side effects. Like what happens if you declare a variable then alias that varible to something else inside a scope, after the scope does the variable go back to the original value? So that means it could be used to in effect localize a lexical variable, which could get _real_ confusing. :-)

Great questions, I hope TheDamian steps in to clear these points up.

Yves
--
You are not ready to use symrefs unless you already know why they are bad. -- tadmc (CLPM)

Replies are listed 'Best First'.
Re: Re: Comprehending Binary :=
by TheDamian (Vicar) on Oct 08, 2001 at 07:48 UTC
    What is the scope of an alias?

    The aliasing persists until the lvalue of the binding ceases to exist. Typically, I think, people will prefer to bind lexicals, so typically the scope will be till the end of their lexical block.

    Would $bound := %data{$key} give me a different $bound as $key changed?

    No. The binding is static and early. That is, the rvalue is evaluated, a reference is taken to the result, and that reference is installed in the lvalues symbol table entry.

    Damian