Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re^3: Does Go steal from Perl? :-)

by RonW (Parson)
on Aug 06, 2018 at 22:14 UTC ( #1219965=note: print w/replies, xml ) Need Help??

in reply to Re^2: Does Go steal from Perl? :-)
in thread Does Go steal from Perl? :-)

There is no such thing as an undefined value and there is certainly no such thing as a numeric context

Actually, even strongly typed languages have a numeric context - and other contexts. In strongly typed languages like Go, the context is used (at compile time) to enforce that a variable or value of a specific type is used.

Also, being strongly typed does not automatically exclude the concept of "undefined value". "undefined" is a sentinel that is reserved and predefined by the language. Many "purists" mistakenly equate undefined with uninitialized. While uninitialized implies undefined, the reverse need not be true. Like "NaN" (not a number) is useful, having undefined as a reserved, predefined representation of a sentinel can also be useful. Otherwise, you have to decide on a value to use as a sentinel, then hope that value never appears in your data.*

Unfortunately, the way Perl uses undefined contributes to the confusion between uninitialized and undefined. It would have been better for Perl to have a flag for uninitialized as well as undefined. At least Perl has a test for undefined. Off hand, I don't recall any other languages that provide a test for undefined.


* While NaN could be used as a sentinel, it's mathematical definition is an unrepresentable value, which is different from an undefined value.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2021-01-23 05:10 GMT
Find Nodes?
    Voting Booth?