Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

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

by ikegami (Patriarch)
on Jan 06, 2012 at 18:34 UTC ( [id://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).

Replies are listed 'Best First'.
Re^8: ref to read-only alias ... why? (notabug)
by LanX (Saint) 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

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.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2024-03-19 11:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found