Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^6: howto parse (or determining end) of a line of perl

by perl-diddler (Chaplain)
on Aug 26, 2016 at 00:40 UTC ( [id://1170506]=note: print w/replies, xml ) Need Help??


in reply to Re^5: howto parse (or determining end) of a line of perl
in thread howto parse (or determining end) of a line of perl

"...KISS is a fine principal to adopt"

Agreed, but "simple" is also subjective.
For me, simple is allowing for same or similar input, not based on context, but also not requiring extra "noise characters" to determine meaning.

Example, one feature my calc has, is I can say a=2*pi*1 and for the LHS assign (_only_, right now), the sigil isn't needed (pi is a sub(){...}). Also doesn't require an ending semi -- allowing less "code-looking-like" input. I can add a semi or a '$' if I want -- and *have* to if 'a' is an array or hash, but for simple vars...allow "simple", non-decorated input. See, there's that word "simple" again... I'm just thinking along simpler lines... (whatever that might imply/mean! ;-)).

Replies are listed 'Best First'.
Re^7: howto parse (or determining end) of a line of perl
by BrowserUk (Patriarch) on Aug 26, 2016 at 00:58 UTC
    Example, one feature my calc has, is I can say a=2*pi*1 and for the LHS assign (_only_, right now), the sigil isn't needed ... See, there's that word "simple" again

    And how much complexity is required to allow you the "simplicity" of omitting one character under some circumstances?

    If you find typing sigils so onerous, I have a suggestion for you: http://www.scilab.org/


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
    In the absence of evidence, opinion is indistinguishable from prejudice.
      Sigils onerous? How about 'unnecessary'? Most languages don't need them. But more to the point, when's the last time you saw calculators using sigils.

      As for how much complexity: 1 line:

      if (/^\w/) { /^\w+=/ and $_='$'.$_ }
      Perl could go, *mostly*, sigil-free if it wanted and remain 100% compat w/previous progs.

      I.e. it would still accept sigils, but for vars w/o sigils -- they would be allowed if predeclared and perl would use the predeclared type. If there was ever a case where more than 1 type was declared for 1 name, then a sigil would be required to differentiate them when using one of them. But in most cases where the same name isn't used w/multiple types, perl would already know the intended type as stated in the declaration.

      Would likely reduce perl's "line noise" reputation and should be 100% compat w/old code (as old code has to have sigils in place, and when in place, then no predeclared-type-default would be used.

        Would likely reduce perl's "line noise" reputation

        You say that like it would be a good thing.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2024-04-18 07:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found