Re: proposal: binding with a function
by BÁRTHÁZI András other posts by this author
Jun 20 2005 8:05AM messages near this date
Re: proposal: binding with a function
|
Re: proposal: binding with a function
Hi,
I'm still interested in, why "alias" wouldn't be a native Perl 6 term?
I think, there are several reasons for "alias":
- in natural languages, synonims are very often - alias is a synonim
- in Perl 6, currently there's no way to create a reference to a
variable, _with the context of the variable_, too (binding just give
me possibility to bind a variable into another, but the new variable
won't be automatically have the same context, as the binded one)
Some new examples, maybe better than before:
sub kilobytes ($value:) is export {
return $value*1024;
}
alias kilobytes, kilobyte;
So both routines will be an exported one. You can use this code then:
say 1.kilobyte;
say 2.kilobytes;
Bye,
Andras
BÃRTHÃZI András wrote:
> Larry,
>
> > You can always write a macro that does that.
> > [...] That won't work on a method name anyway unless you do it in the
> > dispatch class.
> > [...]
> > You'll have to write your own macro if you want to do that.
>
>
> As I understood, you wrote down, how I can workaround it with macros,
> and why it wouldn't work well. As I see, there's no a nice solution to
> alias a method or a sub, even with macros.
>
> But you didn't wrote, why are you against the 'alias'?
>
> Bye,
> Andras
>
Thread:
B=C1RTH=C1ZI_Andr=E1s
Larry Wall
Damian Conway
Ingo Blechschmidt
Juerd
Carl Franks
B=C1RTH=C1ZI_Andr=E1s
B=C1RTH=C1ZI_Andr=E1s
BÁRTHÁZI András
Brent 'Dax' Royal-Gordon
BÁRTHÁZI András
Brent 'Dax' Royal-Gordon
BÁRTHÁZI András
Abhijit Mahabal
|