Mailing List Archive

lexicals and prototypes and all
it seems to me that there's a problem with the idea of assigning
a parameter like this

f(\@list);

sub f(\@) {
local *sym = $_[0];
}

the problem is that you can't do that with my only with local, and you want
to do my. also, you can't do it at all with use strict vars.

what do you think? is this enough of a reason to think about
whether you want to do an automatic lexical aliasing with named paraeters?

that is

sub f(\@alist) { ... }

would make @alist an alias for the reference parameter's referee and still
work under use strict?

--tom
Re: lexicals and prototypes and all [ In reply to ]
On Mon, 20 Nov 1995, Tom Christiansen wrote:

> it seems to me that there's a problem with the idea of assigning
> a parameter like this
>
> f(\@list);

Actually, that should be "f(@list);".

> sub f(\@) {
> local *sym = $_[0];
> }
>
> the problem is that you can't do that with my only with local, and you want
> to do my. also, you can't do it at all with use strict vars.
>
> what do you think? is this enough of a reason to think about
> whether you want to do an automatic lexical aliasing with named paraeters?
>
> that is
>
> sub f(\@alist) { ... }
>
> would make @alist an alias for the reference parameter's referee and still
> work under use strict?

To my way of thinking, this is partially related to the fact that you need
to say "local($_);", instead of "my($_);". The problem isn't the same, but
the result is: local() is still needed, despite being depreciated by my().
I don't have any idea what to do about this, though.

> --tom

--
Kenneth Albanowski (kjahds@kjahds.com, CIS: 70705,126)