Re: proposal: binding with a function

2005-06-23 Thread Damian Conway
Piers Cawley wrote: Here's a rubyish idiom: my &old_behaviour := &function; &function := sub { try_some_stuff || &old_behaviour } Except, with binding it doesn't work like that, you end up with an infinite loop. But this version *should* work correctly: # Bind the name '&old_behav

Re: proposal: binding with a function

2005-06-23 Thread Ingo Blechschmidt
Hi, Juerd convolution.nl> writes: > Piers Cawley skribis 2005-06-23 15:30 (+0100): > > Brent 'Dax' Royal-Gordon gmail.com> writes: > > > As I've said before, Perl supports `alias`--it's just spelled `:=`. > > Here's a rubyish idiom: > > my &old_behaviour := &function; > > &function :

Re: proposal: binding with a function

2005-06-23 Thread Juerd
Piers Cawley skribis 2005-06-23 15:30 (+0100): > Brent 'Dax' Royal-Gordon <[EMAIL PROTECTED]> writes: > > As I've said before, Perl supports `alias`--it's just spelled `:=`. > Here's a rubyish idiom: > my &old_behaviour := &function; > &function := sub { try_some_stuff || &old_behaviour } > Exc

Re: proposal: binding with a function

2005-06-23 Thread Piers Cawley
Brent 'Dax' Royal-Gordon <[EMAIL PROTECTED]> writes: > As I've said before, Perl supports `alias`--it's just spelled `:=`. Here's a rubyish idiom: my &old_behaviour := &function; &function := sub { try_some_stuff || &old_behaviour } Except, with binding it doesn't work like that, you end up

Re: proposal: binding with a function

2005-06-20 Thread BÁRTHÁZI András
Hi, "&kilobytes := &kilobyte;" will not work for you (try it), because you have to declare the "variable" kilobytes - in the default strict mode. But you can't say for ex. "my &kilobytes", if you want to export it. So you say `our &kilobytes ::= &kilobyte` (or `:=`, you still haven't said if a

Re: proposal: binding with a function

2005-06-20 Thread Brent 'Dax' Royal-Gordon
On 6/20/05, BÁRTHÁZI András <[EMAIL PROTECTED]> wrote: > Hi, > > >>- in natural languages, synonims are very often - alias is a synonim > > > > Perl is modeled on natural languages, but that doesn't mean it is one. > > At its core, Perl is a limited, artificial language being explicitly > > desig

Re: proposal: binding with a function

2005-06-20 Thread BÁRTHÁZI András
Hi, - in natural languages, synonims are very often - alias is a synonim Perl is modeled on natural languages, but that doesn't mean it is one. At its core, Perl is a limited, artificial language being explicitly designed with certain goals. One of those goals is that it should be as small a

Re: proposal: binding with a function

2005-06-20 Thread Brent 'Dax' Royal-Gordon
On 6/20/05, BÁRTHÁZI András <[EMAIL PROTECTED]> wrote: > - in natural languages, synonims are very often - alias is a synonim Perl is modeled on natural languages, but that doesn't mean it is one. At its core, Perl is a limited, artificial language being explicitly designed with certain goals. O

Re: proposal: binding with a function

2005-06-20 Thread Abhijit Mahabal
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 r

Re: proposal: binding with a function

2005-06-20 Thread BÁRTHÁZI András
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 v

Re: proposal: binding with a function

2005-06-15 Thread BÁRTHÁZI András
Hi, Carl Franks wrote: : alias newlines, newline; Isn't it possible to add a Role to the relevant Class, which specifies that is 'handles' the method name you want as an alias? If it's possible, it would be fine for me in this particular case. Is it possible? Anyway, IMHO this alias fun

Re: proposal: binding with a function

2005-06-15 Thread Carl Franks
> : alias newlines, newline; Isn't it possible to add a Role to the relevant Class, which specifies that is 'handles' the method name you want as an alias? Carl

Re: proposal: binding with a function

2005-06-14 Thread BÁRTHÁZI András
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

Re: proposal: binding with a function

2005-06-14 Thread Larry Wall
On Tue, Jun 14, 2005 at 02:06:37PM +0200, BÁRTHÁZI András wrote: : Hi, : : As I know, for binding, you can use the := operator, and just this: : : $a := $b; : : I would like to make a proposal, based on Ruby[1]: : : alias $a, $b; You can always write a macro that does that. : It's a fun:

proposal: binding with a function

2005-06-14 Thread BÁRTHÁZI András
Hi, As I know, for binding, you can use the := operator, and just this: $a := $b; I would like to make a proposal, based on Ruby[1]: alias $a, $b; It's a fun: sub newline { "\n" x $_; } alias newlines, newline; So you can write: print 5.enters; Currently, you have to