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

Re^7: ref to read-only alias ... why? (notabug)

by ikegami (Pope)
on Jan 06, 2012 at 18:34 UTC ( #946645=note: print w/ replies, xml ) Need Help??


in reply to Re^6: ref to read-only alias ... why? (notabug)
in thread ref to read-only alias ... why?

Negative. You're are making it consistent by breaking the working case. See Re^4: ref to read-only alias ... why? (not consistent).


Comment on Re^7: ref to read-only alias ... why? (notabug)
Re^8: ref to read-only alias ... why? (notabug)
by dk (Chaplain) on Jan 06, 2012 at 18:38 UTC
    Well, I give up then.
Re^8: ref to read-only alias ... why? (notabug)
by LanX (Canon) on Jan 06, 2012 at 18:44 UTC
    Could you please clarify which the "working case" is in your opinion?

    I agree with tye that there are good arguments for both perspectives.

    Cheers Rolf

      Could you please clarify which the "working case" is in your opinion?

      It shouldn't matter whether your scalar was created by «my $x» or by «123». The literal «123» should return a modifiable value. The code in \ is specifically there to emulate that without the cost of creating a new scalar every time «123» is evaluated.

      I agree with tye that there are good arguments for both perspectives.

      I can't find these arguments. Could you give me a link?

        The literal 123 should return a modifiable value.

        Could you elaborate on that please? I don't find that neither convincing nor intuitive. If that's true, why error message "Modification of a read-only value" exists at all? By the same logic 123++ should be working fine, no?

        > I can't find these arguments. Could you give me a link?

        He didn't list many arguments, thats the link: Re^3: ref to read-only alias ... why? (notabug)

        > It shouldn't matter whether your scalar was created by my $x or by 123.

        So your POW is that the standard behavior is wrong, such that in my code-example inc_a() should better also act like inc_b()?

        Without really understanding the opcode-level I'm wondering why you say that either behaviors are difficult to implement if both already exist.

        IMHO there should always be a configurable (i.e. switchable) warning because different people expect different behavior.

        Cheers Rolf

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (13)
As of 2014-12-18 20:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (62 votes), past polls