Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^2: Perl5 Language Extension: Definedness-Triggered Shortcut Operators

by martin (Friar)
on Mar 18, 2012 at 06:59 UTC ( [id://960265]=note: print w/replies, xml ) Need Help??


in reply to Re: Perl5 Language Extension: Definedness-Triggered Shortcut Operators
in thread RFC: Perl5 Language Extension: Definedness-Triggered Shortcut Operators

Why don't you start by digging into the p5p archives, and refute the reasons why of all the proposals, only // survived? And while you are at it, explain why we need a :|| identical to //.

Twelve years worth of p5p is a lot of ground to dig through, so I have only just begun. Here is a summary of what I have found so far.

  • There has indeed been debate about quite a number of operators looking at definedness.
  • Objections mostly address syntactical issues. Opinions stating that it was bad to have such operators at all seem to be very rare.
  • The "safe arrow" operator in particular has got a lot of support, though its symbol is not quite settled yet. One of its benefits I did not mention in my first post is that it can disable auto-vivification.
  • The double-slash symbol seems to have made it because of high demand for expressions with default values and it being the syntax proposed by Larry Wall for Perl 6.
  • Low-precedence defined-or was initially called "err", but its naming was later challenged. Larry himself did not like "dor" either, and he pointed out that "orelse", which is what "err" evolved into in Perl 6, has different semantics now that would not easily fit into Perl 5.
  • My primary concerns, i.e. the usefulness of short-cutting expression evaluation and the intent to provide more general solutions than an isolated exotic operator, don't seem to have played a major role in the discussion lately.
  • Colons indeed seem to be some sort of holy ground nobody dares to touch.
  • Points made in favour of a new syntax are often among these: (a) Has the new syntax been illegal before, so that old code is not likely to get hurt? (b) Do similar things look similar and dissimilar things look different? (c) Is the new syntax easy to use and remember? (d) Does it fit in the general look-and-feel of the language? (e) Are names free of different meanings or possible misunderstandings? (f) Is the impact on the existing language parser(s) limited?

As to the coexistence of different symbols, I have already tried to convey that one of them should be preferred but the other one cannot suddenly be made illegal. This has precedents, like tr versus y, or version objects versus v-strings.

Replies are listed 'Best First'.
Re^3: Perl5 Language Extension: Definedness-Triggered Shortcut Operators
by JavaFan (Canon) on Mar 18, 2012 at 12:22 UTC
    Opinions stating that it was bad to have such operators at all seem to be very rare.
    There's always the fact that "adding features means more complexity of the implemenation, and hence more work on maintenance". Since this is an opinion carried forward by the handful of people that actually do significant maintenance work, this opinion carries a lot of weight.
    The "safe arrow" operator in particular has got a lot of support, though its symbol is not quite settled yet.
    But it wasn't hung just on syntax. And noone cared enough to restart the discussion. Which, to me, seems it's not an itch that bothers a lot of people.
    The double-slash symbol seems to have made it because of high demand for expressions with default values and it being the syntax proposed by Larry Wall for Perl 6.
    Right. So.... what's your argument to have an :|| as well?
    Low-precedence defined-or was initially called "err", but its naming was later challenged. Larry himself did not like "dor" either, and he pointed out that "orelse", which is what "err" evolved into in Perl 6, has different semantics now that would not easily fit into Perl 5.
    5.9.x had err for sometime (as the low priority version of //). It was decided it was better not to have it. What makes you think the time is right now, and what are your arguments that the concerns of a few years ago aren't concerns anymore?
    My primary concerns, i.e. the usefulness of short-cutting expression evaluation and the intent to provide more general solutions than an isolated exotic operator, don't seem to have played a major role in the discussion lately.
    I don't think there's much disagreement that having more features in the language has a value. But unless said value exceeds the costs it's not going to happen. And even if the value exceeds the costs, someone has to do the work first. Perlmonks is wrong forum to discuss this. Of course, 99.9% of the people here will say "Good idea. When can I have it"? Go pitch your idea on p5p.
    Has the new syntax been illegal before, so that old code is not likely to get hurt?
    That rules out any named operator like err, dor or dand -- unless you make them weak keywords or enable them using features.

      Perlmonks is wrong forum to discuss this. Of course, 99.9% of the people here will say "Good idea. When can I have it"? Go pitch your idea on p5p.

      I thought this was a good place to gather some feedback first. So far it worked. The critical promille of the people here did help, too. I probably should have put "RFC" in the title though. In fact, I will do it now.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-03-29 09:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found