develooper Front page | perl.perl6.language | Postings from June 2005

Re: proposal: binding with a function

Thread Previous | Thread Next
Abhijit Mahabal
June 20, 2005 08:39
Re: proposal: binding with a function
Message ID:
On Mon, 20 Jun 2005, BÁRTHÁZI András wrote:

> Hi,
> I'm still interested in, why "alias" wouldn't be a native Perl 6 term?
> I think, there are several reasons for "alias":

I am not arguing against alias, but just wanted to point out something.

> - in Perl 6, currently there's no way to create a reference to a
>   variable, _with the context of the variable_, too

unless you bind immediately where you declare the original variable:

> Some new examples, maybe better than before:
> sub kilobytes ($value:) is export {
> 	return $value*1024;
> }
> alias kilobytes, kilobyte;

replace the last line with:
   &kilobytes := &kilobyte;

and the scoping is not an issue.

And with synonyms, binding as soon as declaring seems prudent.


Abhijit Mahabal
Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About