6 ms·
Null Island
- perl4ever 7y agohttps://en.wikipedia.org/wiki/Wonowon,_British_Columbia https://en.wikipedia.org/wiki/Wonowon,_British_Columbia
- perl4ever 7y agoAlso, null might be the empty string, but when is it ever zero? Edit: this is a serious question.
- mikestew 7y agoYou can look at headers: #define NULL 0 //C++ #define NULL ((void*)0) //C I think later versions of C++ do something...different, but I’m not up to date enough to know without looking it up.
- perl4ever 7y agoOk, I wasn't thinking of C, but even so, isn't NULL a pointer value, not an integer? If you're treating a null pointer as an integer zero, something's gone very wrong. Also I think I vaguely remember from discussions about the standards, that a NULL pointer is not guaranteed to be numerically equal to zero in a standards compliant compiler. But yeah, I was thinking of database NULLs.
- boring_twenties 7y agoC++03 and earlier stipulate that literal 0 is always the null pointer, whether it really is on any given hardware or not. C++11 and later deprecate this and introduce a new keyword `nullptr`. edit: Also, null is not an empty string. The null character that terminates a string is unrelated to null pointers.
- mikestew 7y agoMan, this is one of those discussions I’d like to drag out for a little bit, but unfortunately not in a position to do so. I will leave you with the idea that null can indeed be a value, as in a null-terminated string. Go look at that guy in memory.
- perl4ever 7y agoIf you're going to split hairs, I'm going to say a NUL character is obviously not the same concept as a NULL in general, nor is it a number that you'd use for a coordinate.
- boring_twenties 7y agoThe definition of NULL is technically machine-dependent in C. It happens to be 0 on (almost?) every machine, but that's not guaranteed. In C++ it's guaranteed to be 0.
- simcop2387 7y agoThe times where it wasn't zero are interesting, https://stackoverflow.com/questions/2597142/when-was-the-null-macro-not-0 https://stackoverflow.com/questions/2597142/when-was-the-nul...
- boring_twenties 7y ago"May you live in interesting times!"
- cdumler 7y agoA language that truly supports null has monadic types, meaning that typed value (scalar, string, object, etc) or something else is specifically tracked (null, undefined, etc). Languages that do not natively support that often have developers that cheat, where they assign some particular value to represent null. Commonly, this is 0 or -1 in numbers and an empty or literal "null" in strings. This works fine unless these values appear actually as legitimate values.
- perl4ever 7y agoLately, I program in a language that has distinct concepts of Null and Empty and Nothing and the empty string ("") and arrays that are not Empty but contain zero elements. And of course NUL characters. This is obviously at least five times as good as just having one option for null.
- speedplane 7y ago> arrays that are not Empty but contain zero elements What is an array that is not empty but contains zero elements?
- saagarjha 7y agoSounds like a trick question. How about the array of the largest number?
- anonymfus 7y agoIIRC in Visual Basic these are arrays with lower bound bigger than upper bound.
- perl4ever 7y ago...but sometimes you can observe this and sometimes you can't.
- perl4ever 7y agoWell, Empty is a special value in VBA. And I forgot to mention, there are two kinds of "empty" arrays that are not Empty. So it's six times as good as a normal language. Here's an example: ' x can be anything, including an array, but ' defaults to the value Empty. Dim x ' y is an array of values that can be anything, ' which defaults to an empty array. Dim y() ' Initialize x as an empty array x = Array() ' The following two statements print 0 and -1. Debug.Print LBound(x) Debug.Print UBound(x) ' The following two statements error with ' "Subscript out of range" even though y ' is also a kind of empty array. Debug.Print LBound(y) Debug.Print UBound(y)
- endorphone 7y agoIt's a fair point. Null is the absence of a value. When used in a programming context it is either a pointer (which is not an integer or a float -- it's the pointer to the absence of an integer or a float. It is not equivalent to 0 or 0.0 or ""), a magic number (specifically for chars), or a special structure with a flag. This more correctly would be "Default=0 Island". A database that doesn't have a nullable field would be the one where you'd have 0.0 as the defaults.
- sverhagen 7y ago>It's a fair point. Pun.
- gwbas1c 7y agoWhen it's a pointer. Remember, a pointer contains the actual address in RAM, or 0 when the pointer is null.
- saagarjha 7y agoUsually, but not always.
- smitty1e 7y agoIt would be cooler to call it Fernando Poo[1]. [1] https://illuminatus.fandom.com/wiki/Fernando_Poo https://illuminatus.fandom.com/wiki/Fernando_Poo
- AlEinstein 7y agoWould it though?
- smitty1e 7y agoThe Illuminatus! Trilogy is all about #Winning.
- shpx 7y agohttps://www.wired.com/2015/11/null/ https://www.wired.com/2015/11/null/
- joeblau 7y agoI was just in Sierra Leone last week and I was telling my brother about this place.
- duxup 7y agoBack when I was a network engineer I liked to imagine that I sent a lot of bad traffic there.
- perl4ever 7y agohttps://stackoverflow.com/questions/59437282/can-i-use-null-as-substitution-for-the-value-of-0 https://stackoverflow.com/questions/59437282/can-i-use-null-...
- saagarjha 7y agoTL;DR: 0 is always NULL, but NULL is not always 0. Checking or assigning a pointer to 0 will work but converting NULL to an integer is implementation-defined.
- stickfigure 7y agoHow does one keep a bouy moored in 5km deep water?
- jagged-chisel 7y ago5.1km cables.
- saagarjha 7y agoThat would allow for quite a bit of drift–a kilometer in each direction.
- jagged-chisel 7y agoThree of them, set in different directions. I’m not saying that’s definitely how it’s done, but it’s how I’d think to do it with nothing other than my naïve geometric education.
- tjoff 7y agoSounds quite expensive. Not sure if the exact position of the buoy is considered that important.
- JadeNB 7y agoHow?
- mkl 7y agoPythagorean Theorem: distance = sqrt(5.1^2 + 5^2) ≈ 1.005km. With the actual depth, 4.94km, not 5km, 5.1 km would give distance = sqrt(5.1^2 + 4.94^2) ≈ 1.267km.
- JadeNB 7y agoI guess you meant -, not +. Indeed, though I know the relevant formula, my intuition so violently failed me that I didn’t even calculate it before deciding it couldn’t be so large.
- speedplane 7y agoEach language can define NULL differently. However, because eventually it gets compiled to machine code, it does indeed need to be represented by some value. Most languages represent that value as 0, but not always. It's better to think about NULL as a value plus a type. The value "False" may be 0 with a boolean type, just as NULL may be 0 with a pointer type.
- CGamesPlay 7y agoGolang has typed nil pointers (that is, a nil *CustomError is not equal to a nil error and so on) and it is probably the single thing that has bitten me the most in go.
- pjc50 7y agoNull is also the absence of a value altogether.
- speedplane 7y ago> Null is also the absence of a value altogether. In digital logic, there is no such thing as an "absence of a value". Everything must be represented as bits one way or another. Computers can certainly represent higher level concepts like an "absence of value", but at the lowest levels, they must be represented by some bit-stream. Types are generally the way that higher level concepts can be translated from low-level bitstreams.
- pjc50 7y agoThere certainly can be an absence of value if the value isn't there. Think serialization or sparse arrays. A null may be represented by the absence of representation.
- galaxyLogic 7y agoIn Smalltalk it is called nil. nil is an instance of the class UndefinedObject. In principle you could subclass UndefinedObject. But what is interesting is that you can add more instance methods to the class UndefinedObject so you could define the method #isNil for instance which could be defined also for all objects, but differently
- perl4ever 7y agoI never learned Objective-C, but I just read that in that language: "NULL is a void *, nil is an id, and Nil is a Class pointer" ...and apparently there is also NSNull. https://nshipster.com/nil/ https://nshipster.com/nil/
- fingerlocks 7y agoFascinating. I wrote objective-c for years and cannot recall ever encountering the proper-noun form of Nil. The other three are quite common.
- 33degrees 7y agoIn Ruby, nil is a singleton instance of NilClass, and defines #nil?, as well as methods to cast to different types e.g. nil.to_a == []. Rails goes a bit further and adds #blank?, which is handy for things that might be nil or empty strings.
- galaxyLogic 7y agoIn JavaScript there's a distinction between 'null' and 'undefined'. You can pick your own semantics for them but I think 'undefined' more or less means "not known" while null means "known not to exist".
- Vanit 7y agoAgreed, but just wanted to add the context that you get undefined values by trying to access uninitialised things such as out of bounds array elements, get on a map-like object with a key that's yet to be set, unset properties on a object, return value of a function that returns void, etc.
- masonic 7y agoI tried to figure out the what3words value for the location but can't find a search term it likes.