Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: Package level scope callbacks.

by BrowserUk (Pope)
on Aug 01, 2004 at 14:52 UTC ( #379081=note: print w/replies, xml ) Need Help??


in reply to Re: Package level scope callbacks.
in thread Package level scope callbacks.

Thanks for some good ideas and sample code.

Overloading "&{}" really would be elegant.

Maybe someone should bring that up on the p6 list in the hope that it can be done over there.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail
"Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon

Replies are listed 'Best First'.
Re^3: Package level scope callbacks.
by ambrus (Abbot) on Aug 01, 2004 at 15:07 UTC

    Overloading "&{}" really would be elegant.

    Maybe someone should bring that up on the p6 list in the hope that it can be done over there.

    Thinking about it again, I'd think no. When you call a sub with f(), you can certainly not overload it as it's dereferencing a glob (like &{*f}()), not a reference, and you can not bless globs the way you can do it with references.

      Hmmm, maybe.

      Will P6 have globs? Will P6 allow overloading of $obj.method( ... ) or $anonRef.( ... ). What, if anything will  use overload "&{}" do or mean?

      Interesting possibilities portend.


      Examine what is said, not who speaks.
      "Efficiency is intelligent laziness." -David Dunham
      "Think for yourself!" - Abigail
      "Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon

        Globs are a remnant from non-lexical days and are going away in Perl6. However, many other things are happening; stuff like compile-time modification of the very language and real macros la LISP come to mind, obviously, though in this case, they'll probably be overkill. Packages, classes, and modules will become first-level citizens in Perl6 (allowing stuff like anonymous packages), and there will probably be an elegant solution for your problem on that vector.

        I really can't wait to get my hands on the thing. :-) It will no doubt be scary and uncomfortable at first and we'll make mistakes like they were made in Perl5 (inherit from Exporter? OO interface for Data::Dumper? what the..?), but there's exciting stuff ahead.

        Makeshifts last the longest.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://379081]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2021-05-14 04:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Perl 7 will be out ...





    Results (148 votes). Check out past polls.

    Notices?