Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Re: Re: Re^2: NO PERL 6

by Elian (Parson)
on Dec 10, 2002 at 21:45 UTC ( #218926=note: print w/ replies, xml ) Need Help??


in reply to Re: Re: Re^2: NO PERL 6
in thread NO PERL 6

Don't forget that uses are compile-time things. You throw the parser modification code into a module and use it in the block that you want it in effect for. The module then pushes the changes to the parser module out to the user's scope. Then, when the compiler continues on it uses the new parser code.

Something like the way strict works now, pushing things out to its caller.


Comment on Re: Re: Re: Re^2: NO PERL 6
Select or Download Code
Re: Re: Re: Re: Re^2: NO PERL 6
by jryan (Vicar) on Dec 10, 2002 at 22:53 UTC

    So, will this code die 50% of the time?

    { $type = ('hex','oct')[rand 2]; eval qq[ rule Perl::Literals::$type::number { {die 'this base no longer exists'} } ]; print 0o017; }
      No, since the change won't make it out of the eval block, and the changes are done at runtime anyway. You need a use. The changes have to be in place at compile time to take effect.

        However, if the modifications to the parser are made in a BEGIN block, won't the changes go out of scope once the block is finished?

        Maybe some sort of new block (maybe PARSE) could be created, such that it acts like a BEGIN block, but changes made within the block do not go out of scope when the block is finished?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (7)
As of 2014-08-30 16:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (293 votes), past polls