ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl6-language
perl6-language
Re: proposal: binding with a function
by Brent 'Dax' Royal-Gordon other posts by this author
Jun 20 2005 11:06AM messages near this date
Re: proposal: binding with a function | Re: proposal: binding with a function
On 6/20/05, BÁRTHÁZI András <andras@[...].hu>  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 <brent@[...].com> 
Perl and Parrot hacker
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

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved