Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^2: parser bug handling 'do ($foo)->{bar}' ?

by LanX (Saint)
on Oct 14, 2014 at 14:12 UTC ( [id://1103745]=note: print w/replies, xml ) Need Help??


in reply to Re: parser bug handling 'do ($foo)->{bar}' ?
in thread parser bug handling 'do ($foo)->{bar}' ?

Thanks a lot that makes things a bit clearer. :)

But could you explain how do FILE which does per definition an eval is more a flow control than just eval ?

update

Not to mention that flow control statements don't return values. (maybe with the exception of short circuiting expressions)

Cheers Rolf

(addicted to the Perl Programming Language and ☆☆☆☆ :)

Replies are listed 'Best First'.
Re^3: parser bug handling 'do ($foo)->{bar}' ?
by Eily (Monsignor) on Oct 14, 2014 at 14:54 UTC

    My answer starts by "I guess", so you have to take it for what it is. do FILE; is kinda like goto FILE; except it works. Like goto, do has two different meanings depending on the syntax, and the flow-control side means the keywords are not parsed like most other.

    Edit: I'm not saying that do is always flow control, but that since it may be, the parser deals with it differently

      We all are only guessing. ;)

      But asking enough questions might eventually lead to an answer! =)

      Never (modulo Alzheimer) heard of the "looks like function rule" , but Deparse mentions it.

      Grateful for deeper insight!

      Cheers a questioning mind

      (addicted to the Perl Programming Language and ☆☆☆☆ :)

      > Edit: I'm not saying that do is always flow control, but that since it may be, the parser deals with it differently

      From do EXPR

      Uses the value of EXPR as a filename and executes the contents of the file as a Perl script. do 'stat.pl'; is largely like eval `cat stat.pl`;

      hope you understand now why I have problems to see the diff to eval regarding flow control.

      Cheers Rolf

      (addicted to the Perl Programming Language and ☆☆☆☆ :)

        I do understand. I think too that it would be more intuitive for do EXPR; to be parsed as eval EXPR; but I'll sleep better for having an idea of where the difference comes from :).

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2024-04-19 20:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found