lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 15 February 2011 11:34, Axel Kittenberger <axkibe@gmail.com> wrote:
> peter> I suspect that the motivation is either religious or academic.
>
> I wonder what religous would mean in these context? But in the sense
> of temporaty being detached from having to solve any particular
> problem right here, right now (which I would call engineering).
> Instead wondering, what would happen if...? what would it mean if... ?
> What would be the further conseqeunces? In that regard it is academic.
> (Altough I don't see my academic career in informatics).
>
> A few years ago, when someone suggested, "get rid of the null
> pointer", I'd say s/he is just crazy. It only recently occured to me,
> for a language in which every variable is stored in a hashtable, in
> which a key/value can simply be missing, it might be possible to get
> away from nulled entries. Well not every variable, there are still
> local variables, which would just have to be non-nulled.

Well from this your reasoning sounds academic. "What would a language
without nulls look like?"

A religious reason would be something like "I was bitten by a Null
Pointer Exception in Java. Nulls are evil and must be eradicated"

Sort of like the nonsense you get when people get riled up about

# Top/bottom posting
# Windows/Linux
# Emacs/Vi

As a practical man nil has many uses.

if person.age == nil
  -- Ask them how old they are
end

Nil means I don't know the value, I can live with that. However if I
cannot use nil then either I have to introduce another variable
person.age_is_known = {true,false} and make the logic more complicated
or use some special value to mean unknown like -1. But then -1 has
become a magic number and I don't like them at all.

For some things such as dates there is really no sensible magic
number. Given any date someone was born on that date and something
happened on that date so you can't say that any date is safe.