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

Re: proposal: binding with a function

Thread Previous | Thread Next
June 20, 2005 11:27
Re: proposal: binding with a function
Message ID:

>>"&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 alias works at compile time or runtime) and call it a day.
> IIUC, traits like `is exported` are attached to the container, not the
> name; since aliasing connects a name to a container, you should be
> fine on that front.  (If it doesn't work, that's because `is exported`
> does something funky that `alias` would have to treat as a special
> case; certainly other traits like `is rw` would follow a
> `:=`-binding.)
>>Anyway, "alias" is a Ruby term, and if Parrot will be able to support
>>Ruby, then it will be able to support this function, too.
> As I've said before, Perl supports `alias`--it's just spelled `:=`.

If you're right, then I'm happy. I don't want "alias", I would like to 
get it's behaviour. In Ruby, I think it's a compile time feature, but 
don't know, I'm not programming in Ruby.

I'm not (yet) an expert in Perl 6, so sorry if I'm not right, but "is 
exported" is about the name, not the container, as I think. If you 
attach an "is exported" to a class method, you can reach it from 
everywhere, just using it's name. If you say _in your class_ that "our 
&mysub ::= &exportedsub", then you can reach the mysub sub just in the 
class, not from everywhere in your program (as a plain sub). I'm really 
not sure, if I'm right, so please tell me, that I lost, and I will be 
happy. :)


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