develooper Front page | perl.perl5.porters | Postings from December 2019

Re: Aliasing and Read-only variables

David Nicol
December 2, 2019 19:17
Re: Aliasing and Read-only variables
Message ID:
I like prefix backslash because it is similar to C++ pass-by-reference
syntax. As that's the default in Perl though -- for direct access into @_
at least -- I'm gathering the idea is

   sub mysub($foo,$bar, baz){ ...

is the same as
   sub mysub{ my ($foo, $bar, $baz) = @_       ; ... # copies

    mysub($foo,$bar,\$baz){ ...
copies $foo and $bar but $baz is an alias? Just like a C++ argument
declaration of
    scalar_t mysub (scalar_t foo, bar, &baz) {...
would do?

does that match the big proposal I didn't read in detail?

also, does it match my-list assignment syntax, so the transform from having
an argument list to starting the subroutine with assignment to the argument
list would still work, were it to be implemented as a source filter?

Coming to you live, from behind Sneelock's store, in the big vacant lot. Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About