Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: Re^2: NO PERL 6

by pdcawley (Hermit)
on Dec 10, 2002 at 08:05 UTC ( #218749=note: print w/replies, xml ) Need Help??

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

It's my understanding that Perl 6's syntax mutation capabilities will be a good deal safer than using C #defines. In fact, I'd argue that the current state of the Perl syntax munging art, Source Filters, are more like C macros than Perl 6 rules will be. Perl 6 rules are so much safer, they take away the need to do your own (possibly fallible) parsing of Perl source code, you just modify the rules at the appropriate level in the grammar and away you go. Also, rule based syntax modification is lexically scoped, which is definitely handy...

Replies are listed 'Best First'.
Re^4: NO PERL 6
by Aristotle (Chancellor) on Dec 10, 2002 at 13:33 UTC

    I was referring to abuse, not robustness. Like any other form of syntax or semantics alteration (operator overloading comes to mind), there are good reasons to have the opportunity (operator overloading comes to mind), but making use of it just because you can will easily create a maintenance nightmare (operator overloading comes to mind). And operator overloading is a relatively mild form of this. Perl 6 will allow really drastic interventions.

    I am excited about the possibilities, but I hope people use the opportunity carefully. It'll most likely turn out to be one of those things you should not do unless you know why you not.

    Makeshifts last the longest.

Re: Re: Re^2: NO PERL 6
by jryan (Vicar) on Dec 10, 2002 at 21:30 UTC
    Also, rule based syntax modification is lexically scoped, which is definitely handy...

    How exactly is that supposed to work? It seems a bit paradoxical to me. Allowing lexical modification of the parser would have to happen at run-time; the only problem being that run-time is after compile-time :) I was under the impression that the process would be more like:

    1. The code must be in a BEGIN block or be use'd (same thing).
    2. The BEGIN block is parsed, compiled, and run with the current parser.
    3. When it is evident that parser rules are being overwritten, a copy of the parser is made.
    4. Modifications to the parser are actually made on the copy.
    5. When the BEGIN block exits, the modified parser becomes the real parser.
      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.

        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; }

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://218749]
NodeReaper sorts his collection of toe tags, by blood type

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2017-12-13 04:36 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (345 votes). Check out past polls.