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

Re^5: Quantum Weirdness and the Increment Operator

by itub (Priest)
on Jun 24, 2004 at 15:42 UTC ( #369406=note: print w/replies, xml ) Need Help??

in reply to Re^4: Quantum Weirdness and the Increment Operator
in thread Quantum Weirdness and the Increment Operator

I think the behavior is definable, we just haven't written it down to define it.

I think you don't understand the idea behind the concept of "undefined behavior" in language specifications. It doesn't mean that the language will use a random number generator to give you an unpredictable result every time. In most cases, you'll find that the behavior is perfectly reproducible, and you could think of documenting it. Don't do it! Undefined behavior means that compiler writers has the freedom to choose whatever behavior they want, and the users of the language SHOULD NOT rely on the way the behavior is "defined", because the compiler writer has the freedom to change it in the next version.

It's just like saying: cool, this module has this interesting undocumented variable! Let's use it! If you use it, it's under your own risk. The documentation is like a contract. And please don't send a documentation patch to the author before making sure that it's not undocumented for a reason.

  • Comment on Re^5: Quantum Weirdness and the Increment Operator

Replies are listed 'Best First'.
Re^6: Quantum Weirdness and the Increment Operator
by japhy (Canon) on Jun 24, 2004 at 16:26 UTC
    But I don't think this behavior should be changed, unless you were to change how Perl uses its variables entirely! It works naturally (that is, following a set of natural rules) due to how Perl itself works (that is, due to Perl's set of rules).
    Jeff[japhy]Pinyan: Perl, regex, and perl hacker, who'd like a job (NYC-area)
    s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;

      This behaviour has been under discussion as something just may well change. There was a discussion between Juerd and hv once where Juerd said something something the current way being the only sane way, really, and then hv countered with something else reasonable (this is all perl6 mind you) and noted that this behaviour is undefined for a reason.

      The observed behaviour is an artifact of the implementation - different implementations are allowed to have different behaviours.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://369406]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2018-05-26 22:29 GMT
Find Nodes?
    Voting Booth?