Can't comment on anything more than that right now. Have yet to dive very deep into it.
Can't comment on anything more than that right now. Have yet to dive very deep into it.
Nil tends to be used in languages where the concept of nothing is represented by some sort of container. In lisp, it's simply the empty list (since all data lives in lists in lisp). In Ruby, it's a singleton object that inherits from the same base class as everything else. In both cases, the language is structured such that every container can easily be asked the question "Are you nil?" (as opposed to false or 0).
That's not true. Every modern Lisp implementation has many primitive data structures: vectors, hash tables, etc.
Nil: Ruby, Go, Oberon, Modula-2, Swift, various Pascal dialects, Lisp?.
Null: C/C++, Java, Rust, JavaScript, Ada.
Then, of course, there's Python with None.
Nil: Lua
Null: PHP
For finding an analogue for the typical null use case in Rust, one would use the `None` variant of the `Option` enum.
Neither nil, null, none or undef refer to (void*)NULL, they are usually a special symbol in the global symbol table. Only some languages use null/nil as NULL/0 internally.
Matz (ruby) also borrowed nil from Lisp. (He was also inspired by Smalltalk.)
Many languages use "null" in similar ways. I guess it's a matter of particular syntactic conventions.
The nil-()-false correspondence is only specific to the Lisp dialects which are close to the original tree. In Scheme, an empty list is indeed (), and this object also the terminating atom of a list. However, the object isn't a symbol at all, let alone the symbol nil. Moreover, the object isn't a Boolean false; Scheme has #f for that.