New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aliasing in signatures #16259
Comments
From zefram@fysh.orgCreated by zefram@fysh.orgWhen we first implemented signatures, the requirement that they involve While scalar parameters can be aliased directly to argument scalars, there Another operation that is meaningful and might be included here is An obvious approach to both kinds of aliasing is to incorporate the An obvious syntax to start with is "(\$x)", but we must be careful use feature "signatures"; would behave as sub clear_referent { A runtime error should occur if the argument supplied for this kind of If this kind of reference argument is optional, aliasing can still be If this kind of parameter is unnamed, the argument type check should Now, aliasing to the argument scalars themselves. In terms of refaliasing use feature "signatures"; would behave as sub clear { With array and hash parameters we'd have "(@x\)" aliasing array elements If an argument is optional, following the logic of the notional "\=" This kind of aliasing is mostly a no-op on unnamed parameters. "($\)" It's also necessary to think about how aliasing would interact with Perl Info
|
From @ilmariZefram (via RT) <perlbug-followup@perl.org> writes:
[snip details] I've implemented this part on the smoke-me/ilmari/signature-refaliasing
I did consider the case of aliasing the actual passed value instead of
Could this \= operator be generalised to work outside signatures, by Then $foo \= $bar; would be equivalent to \$foo = \$bar; and @foo \= @bar; would alias each element of @foo to the corresponding element of @bar - ilmari |
The RT System itself - Status changed from 'new' to 'open' |
From zefram@fysh.orgDagfinn Ilmari Mannsaker wrote:
That's possible, yes. We'd have to think more about the spelling, but I
It *can* be done with current refaliasing: \(@foo) = \(@bar); but the notional %foo \= ...; can't be done with any single refaliasing assignment. (You can iterate -zefram |
Migrated from rt.perl.org#132472 (status was 'open')
Searchable as RT132472$
The text was updated successfully, but these errors were encountered: