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

Re: proposal: binding with a function

Thread Previous | Thread Next
From:
Abhijit Mahabal
Date:
June 20, 2005 08:39
Subject:
Re: proposal: binding with a function
Message ID:
Pine.LNX.4.63.0506201033560.9426@sluggo.cs.indiana.edu
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

Abhijit Mahabal      http://www.cs.indiana.edu/~amahabal/
Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About