logo       


Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

Re: Metaprogramming: msg#00029

Subject: Re: Metaprogramming
Randal L. Schwartz wrote in perl.fwp :
> 
>     sub black_adder {
>       my $constant = shift;
>       sub { $constant + shift; }
>     }
> 
>     my $to_deparse = black_adder(42);
>     use B::Deparse;
>     print "\n", B::Deparse->new->coderef2text($to_deparse), "\n";
> 
>==>
> 
>     {
>         $constant + shift(@_);
>     }
> 
> Ayup.  That's the one.  *What* constant? :)  And that was the
> first odd one I tried.  I could probably construct weirder ones
> once that one is fixed.

What do you expect B::Deparse::coderef2text to do here ? Output
something equivalent to { 42 + shift } ? or produce an error ("can't
deparse a closure without complete lexical context") ?

I think that the ideal thing to do is to allow deparsing closures when
the invocation to coderef2text is done at a point where the outside
lexical contexts have been closed -- and fail otherwise. For example, it
should refuse to deparse in the following situation :

    sub foo {
        my $constant = shift;
        my $closure = sub { $constant + shift };
        print B::Deparse->new->coderef2text($closure); # should be forbidden !
        ++$constant;
        $closure;
    }
    print B::Deparse->new->coderef2text(foo(42)); # but OK here.

This shouldn't be very hard to fix (once the appropriate tuits about
CvOUTSIDE and other padlists are harvested.) A neat little fun-with-perl
project for anyone.



Ruby Jobs
Java Jobs
Jobs in California
more...
what
job title, keywords
where
city, state, zip
jobs by job search
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
db.firebase.por...    text.xml.xalan....    qnx.openqnx.dev...    user-groups.zar...    internationaliz...    kde.devel.konve...    finance.e-gold....    emacs.latex.pre...    gis.therion/200...    web.webmin.gene...    yellowdog.gener...    vserver/2003-08...    redhat.release....    sysutils.tivoli...    xfree86.expert/...    mail.becky.user...    hardware.netapp...    netbsd.ports.xe...    python.distutil...    boot-loaders.gr...    culture.interne...    java.springfram...    activedir/2006-...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe