On julia-dev, I've been asking questions to help me flesh out a formal policy
for representing NULL-ness as it occurs in many common situations. I think a
full FAQ entry will need to be a whole section of the manual (i.e. the section
on Nullable{T}), covering things like missing values in statistics and
databases, null pointers in recursive data structures, finalized iterators, etc.
Right now, I think we don't have a totally coherent story. People have started
using isdefined in non-Base code, which I think is the first step towards
#undef becoming a de facto first-class citizen. And the use of things like an
EmptyTree type in DataStructures.jl means that absence is also being
represented in a type-unstable way in some packages.
(https://github.com/JuliaLang/DataStructures.jl/blob/master/src/tree.jl)
-- John
On Oct 9, 2014, at 8:01 AM, Stefan Karpinski <[email protected]> wrote:
> On Thu, Oct 9, 2014 at 8:50 AM, Ivar Nesje <[email protected]> wrote:
> How can I return #undef from a function?
>
> You will have to modify the internals of Julia so that #undef becomes a value
> that can be passed around. Currently it isn't, but we have a new concept in
> 0.4-dev with nullable types that might suit your need.
>
> Please don't try to actually do this – the fact that #undef is not a
> first-class value is very much by design. Tony Hoare has given entire talks
> about why including null references as first class values in Algol was a
> "billion dollar mistake", which was of course, then copied by C, Java, etc.
> This should perhaps go in our FAQ.