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 > > designed with certain goals. One of those goals is that it should be > > as small as possible given the feature set we want it to support; an > > `alias` built-in that essentially duplicates an existing feature goes > > against that goal. > > I can agree with it, but I think it would be a great feature. And it > doesn't depends on Perl 6, but it depends on Parrot, as I think. > > >>- 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) > > > > I'm not sure what you mean by "context" here. Context has a very > > specific meaning in Perl, representing the type a function's caller is > > expecting; this doesn't seem to be what you're talking about here. > > > >>alias kilobytes, kilobyte; > > > > This is a couple punctuation symbols short of: > > &kilobytes := &kilobyte; > > Or maybe: > > &kilobytes ::= &kilobyte; > > I'm not really sure what behavior you have in mind for alias. > > "&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 `:=`. -- Brent 'Dax' Royal-Gordon <[EMAIL PROTECTED]> Perl and Parrot hacker