Re: [julia-users] Re: Nullable use cases / expected behavior?

2015-01-07 Thread Ivar Nesje
Forgot to say Base.== returns bool, so this now makes == type unstable. Type stable (in the context of Julia) means that the return type can be statically inferred from the argument types. This means that + is type stable, even though it returns a Float64 if the arguments are Float64 and

Re: [julia-users] Re: Nullable use cases / expected behavior?

2015-01-07 Thread Milan Bouchet-Valat
Le mercredi 07 janvier 2015 à 14:19 +0100, Tamas Papp a écrit : On Wed, Jan 07 2015, Milan Bouchet-Valat nalimi...@club.fr wrote: Le mercredi 07 janvier 2015 à 04:25 -0800, ele...@gmail.com a écrit : A Nullable is immutable, its value isn't down the back of the couch (which is my

Re: [julia-users] Re: Nullable use cases / expected behavior?

2015-01-07 Thread Milan Bouchet-Valat
Le mercredi 07 janvier 2015 à 04:25 -0800, ele...@gmail.com a écrit : On Wednesday, January 7, 2015 9:36:28 PM UTC+10, Milan Bouchet-Valat wrote: Le mardi 06 janvier 2015 à 05:27 -0800, ele...@gmail.com a écrit : On Tuesday, January 6, 2015 10:43:16

Re: [julia-users] Re: Nullable use cases / expected behavior?

2015-01-07 Thread Tamas Papp
On Wed, Jan 07 2015, Milan Bouchet-Valat nalimi...@club.fr wrote: Le mercredi 07 janvier 2015 à 04:25 -0800, ele...@gmail.com a écrit : A Nullable is immutable, its value isn't down the back of the couch (which is my understanding of epistemological missingness, usually applied to the TV

Re: [julia-users] Re: Nullable use cases / expected behavior?

2015-01-07 Thread elextr
A Nullable is immutable, its value isn't down the back of the couch (which is my understanding of epistemological missingness, usually applied to the TV remote :), it can never get a value once its null. That's not a technical question (immutable/mutable), but a conceptual one. If

Re: [julia-users] Re: Nullable use cases / expected behavior?

2015-01-07 Thread Milan Bouchet-Valat
Le mardi 06 janvier 2015 à 05:27 -0800, ele...@gmail.com a écrit : On Tuesday, January 6, 2015 10:43:16 PM UTC+10, Milan Bouchet-Valat wrote: Le mardi 06 janvier 2015 à 04:38 -0800, ele...@gmail.com a écrit : On Tuesday, January 6, 2015 7:38:00 PM

Re: [julia-users] Re: Nullable use cases / expected behavior?

2015-01-07 Thread elextr
On Wednesday, January 7, 2015 9:36:28 PM UTC+10, Milan Bouchet-Valat wrote: Le mardi 06 janvier 2015 à 05:27 -0800, ele...@gmail.com javascript: a écrit : On Tuesday, January 6, 2015 10:43:16 PM UTC+10, Milan Bouchet-Valat wrote: Le mardi 06 janvier 2015 à 04:38 -0800,

Re: [julia-users] Re: Nullable use cases / expected behavior?

2015-01-06 Thread Milan Bouchet-Valat
Le lundi 05 janvier 2015 à 19:16 -0800, ele...@gmail.com a écrit : My reasoning for Nullable{T} is that it is type stable. Taking your example, None and Int would be different type objects, introducing a type instability and potential performance penalty. But Nullable{T} is always type

Re: [julia-users] Re: Nullable use cases / expected behavior?

2015-01-06 Thread elextr
On Tuesday, January 6, 2015 10:43:16 PM UTC+10, Milan Bouchet-Valat wrote: Le mardi 06 janvier 2015 à 04:38 -0800, ele...@gmail.com javascript: a écrit : On Tuesday, January 6, 2015 7:38:00 PM UTC+10, Milan Bouchet-Valat wrote: Le lundi 05 janvier 2015 à 19:16 -0800,

Re: [julia-users] Re: Nullable use cases / expected behavior?

2015-01-06 Thread Milan Bouchet-Valat
Le mardi 06 janvier 2015 à 04:38 -0800, ele...@gmail.com a écrit : On Tuesday, January 6, 2015 7:38:00 PM UTC+10, Milan Bouchet-Valat wrote: Le lundi 05 janvier 2015 à 19:16 -0800, ele...@gmail.com a écrit : My reasoning for Nullable{T} is that it is type stable. Taking

Re: [julia-users] Re: Nullable use cases / expected behavior?

2015-01-06 Thread elextr
On Tuesday, January 6, 2015 7:38:00 PM UTC+10, Milan Bouchet-Valat wrote: Le lundi 05 janvier 2015 à 19:16 -0800, ele...@gmail.com javascript: a écrit : My reasoning for Nullable{T} is that it is type stable. Taking your example, None and Int would be different type objects,

Re: [julia-users] Re: Nullable use cases / expected behavior?

2015-01-06 Thread Seth
On Tuesday, January 6, 2015 4:43:16 AM UTC-8, Milan Bouchet-Valat wrote: Yeah, (==){T}(a::Nullable{T}, b::T) should be able to be defined as !isnull(a) get(a) == b I'd consider this definition (which is different from the ones I suggested above) as unsafe: if `a` is `null`, then

Re: [julia-users] Re: Nullable use cases / expected behavior?

2015-01-06 Thread elextr
Oops posted too soon :) On Wednesday, January 7, 2015 10:37:01 AM UTC+10, ele...@gmail.com wrote: [...] This definition will be type-stable (it will always return a Nullable{Bool}) and it will be able to signal all three possible results; get(a) == b, get(a) != b and get(a) == null.

Re: [julia-users] Re: Nullable use cases / expected behavior?

2015-01-06 Thread elextr
[...] This definition will be type-stable (it will always return a Nullable{Bool}) and it will be able to signal all three possible results; get(a) == b, get(a) != b and get(a) == null. It is then messy to use == in an if when the return is not a bool. In fact you still have to write the

Re: [julia-users] Re: Nullable use cases / expected behavior?

2015-01-06 Thread Tomas Lycken
I think many of the questions raised in this thread can be answered by considering the history behind why Nullable{T} was introduced in the first place; to replace NAtype and NA, from the DataArrays package. As such, Nullable{T} is supposed to be used more as Milan describes, than as a drop-in

[julia-users] Re: Nullable use cases / expected behavior?

2015-01-05 Thread elextr
My reasoning for Nullable{T} is that it is type stable. Taking your example, None and Int would be different type objects, introducing a type instability and potential performance penalty. But Nullable{T} is always type Nullable{T} and get(Nullable{T}) is always type T. Allowing Nullable{T}