[julia-users] Re: Nothing conditional operator

2016-03-19 Thread Jeffrey Sarnoff
You may be misusing nothing.  It is unusual that a function would return 
nothing some of the time and something other times.
Take a look at 
http://docs.julialang.org/en/latest/manual/faq/#nothingness-and-missing-values
If you have additional questions about this, please give an example of what 
get_a(...) is getting and why it would be nothing some of the time.

On Tuesday, March 15, 2016 at 12:21:35 PM UTC-4, FANG Colin wrote:
>
> Hi All
>
>
> I found my self writing code like this a lot:
>
> x = get_a(...)
>
> if x != nothing
> y::A = x
> do_sth(y, ...)
> end
>
> In the above, I have to check for nothing first, and if it is not nothing, 
> then I do a type assert to make sure the type is what I expected.
>
> Is there any function or macro in Julia that can help this?
>
> I know in F#, I have option.bind, so option.bind f x is equivalent to a 
> pattern match:  if x is None - > None; if x is something -> f(something)
>
> Also in C#, I have "customers?[0]?.Orders?.Count();"  (as long as there 
> is null before ?, it returns null immediately)
>
> Does Julia have something similar?
>
>

Re: [julia-users] Re: Nothing conditional operator

2016-03-19 Thread Milan Bouchet-Valat
For now I don't know of a good solution to this pattern, but there's
been some discussion about it:
https://github.com/JuliaLang/julia/issues/15174

You should definitely use a Nullable instead of returning nothing.


Regards

Le samedi 19 mars 2016 à 02:58 -0700, Jeffrey Sarnoff a écrit :
> You may be misusing nothing.  It is unusual that a function would
> return nothing some of the time and something other times.
> Take a look at http://docs.julialang.org/en/latest/manual/faq/#nothin
> gness-and-missing-values
> If you have additional questions about this, please give an example
> of what get_a(...) is getting and why it would be nothing some of the
> time.
> 
> > Hi All
> > 
> > 
> > I found my self writing code like this a lot:
> > 
> > x = get_a(...)
> > 
> > if x != nothing
> >     y::A = x
> >     do_sth(y, ...)
> > end
> > 
> > In the above, I have to check for nothing first, and if it is not
> > nothing, then I do a type assert to make sure the type is what I
> > expected.
> > 
> > Is there any function or macro in Julia that can help this?
> > 
> > I know in F#, I have option.bind, so option.bind f x is equivalent
> > to a pattern match:  if x is None - > None; if x is something ->
> > f(something)
> > 
> > Also in C#, I have "customers?[0]?.Orders?.Count();"  (as long as
> > there is null before ?, it returns null immediately)
> > 
> > Does Julia have something similar?
> > 
> > 


Re: [julia-users] Re: Nothing conditional operator

2016-03-20 Thread jock . lawrie
Redis.jl returns nothing when requesting a the value of a key that doesn't 
exist:

using Redis
conn = RedisConnection()
r = get(conn, "non_existent_key")
disconnect(conn)
r == nothing# true


On Sunday, March 20, 2016 at 1:31:30 AM UTC+11, Milan Bouchet-Valat wrote:
>
> For now I don't know of a good solution to this pattern, but there's 
> been some discussion about it: 
> https://github.com/JuliaLang/julia/issues/15174 
>
> You should definitely use a Nullable instead of returning nothing. 
>
>
> Regards 
>
> Le samedi 19 mars 2016 à 02:58 -0700, Jeffrey Sarnoff a écrit : 
> > You may be misusing nothing.  It is unusual that a function would 
> > return nothing some of the time and something other times. 
> > Take a look at http://docs.julialang.org/en/latest/manual/faq/#nothin 
> > gness-and-missing-values 
> > If you have additional questions about this, please give an example 
> > of what get_a(...) is getting and why it would be nothing some of the 
> > time. 
> > 
> > > Hi All 
> > > 
> > > 
> > > I found my self writing code like this a lot: 
> > > 
> > > x = get_a(...) 
> > > 
> > > if x != nothing 
> > > y::A = x 
> > > do_sth(y, ...) 
> > > end 
> > > 
> > > In the above, I have to check for nothing first, and if it is not 
> > > nothing, then I do a type assert to make sure the type is what I 
> > > expected. 
> > > 
> > > Is there any function or macro in Julia that can help this? 
> > > 
> > > I know in F#, I have option.bind, so option.bind f x is equivalent 
> > > to a pattern match:  if x is None - > None; if x is something -> 
> > > f(something) 
> > > 
> > > Also in C#, I have "customers?[0]?.Orders?.Count();"  (as long as 
> > > there is null before ?, it returns null immediately) 
> > > 
> > > Does Julia have something similar? 
> > > 
> > > 
>


Re: [julia-users] Re: Nothing conditional operator

2016-03-20 Thread Jeffrey Sarnoff
Redis itself is written in C. They document GET key:

> Get the value of key. If the key does not exist the special value nil is 
> returned. 

An error is returned if the value stored at key is not a string, because GET 
 only handles string values.

 
 digging deeper

The client library API should not return an empty string, but a nil object, 
when the server replies with a Null Bulk String. 

For example a Ruby library should return 'nil' while a C library should 
return NULL (or set a special flag in the reply object), and so forth.


Single elements of an Array may be Null. This is used in Redis replies in 
order to signal that this elements are missing and not empty strings. 

This can happen with the SORT command when used with the GET *pattern* option 
when the specified key is missing.

[For example, if the] second element is a Null. The client library should 
> return something like this: ["foo", nil, "bar"]


The Redis *nil* indicates a non-present value (missing or unavailable or, not 
extant: a domain|-> range error).

>From a semiotic viewpoint, Julia's *nothing* is closer to "absence" than it is 
>to "an absent value"; of course

the operational machinery supplies an actual entity to be *nothing* (a 
singleton realization ofthe type Void).


A much more contextual fit be the use of Nullable, although that may require 
more of the client; a simpler way

to handle the Redis *nil* without doing something with *nothing* is to use a 
dedicated const symbol or a singleton

to be that sentinel, perhaps:  

* const RedisNil = :RedisNil# or*

 *type RedisNIL end; RedisNil = RedisNIL()*


*Somewhere there are lengthy and informative discussions about Julia and nil / 
NULL / nothing.*

*(I noted this thread to the Redis.jl project).*







On Sunday, March 20, 2016 at 6:45:57 PM UTC-4, jock@gmail.com wrote:
>
> Redis.jl returns nothing when requesting a the value of a key that doesn't 
> exist:
>
> using Redis
> conn = RedisConnection()
> r = get(conn, "non_existent_key")
> disconnect(conn)
> r == nothing# true
>
>
> On Sunday, March 20, 2016 at 1:31:30 AM UTC+11, Milan Bouchet-Valat wrote:
>>
>> For now I don't know of a good solution to this pattern, but there's 
>> been some discussion about it: 
>> https://github.com/JuliaLang/julia/issues/15174 
>>
>> You should definitely use a Nullable instead of returning nothing. 
>>
>>
>> Regards 
>>
>> Le samedi 19 mars 2016 à 02:58 -0700, Jeffrey Sarnoff a écrit : 
>> > You may be misusing nothing.  It is unusual that a function would 
>> > return nothing some of the time and something other times. 
>> > Take a look at http://docs.julialang.org/en/latest/manual/faq/#nothin 
>> > gness-and-missing-values 
>> > If you have additional questions about this, please give an example 
>> > of what get_a(...) is getting and why it would be nothing some of the 
>> > time. 
>> > 
>> > > Hi All 
>> > > 
>> > > 
>> > > I found my self writing code like this a lot: 
>> > > 
>> > > x = get_a(...) 
>> > > 
>> > > if x != nothing 
>> > > y::A = x 
>> > > do_sth(y, ...) 
>> > > end 
>> > > 
>> > > In the above, I have to check for nothing first, and if it is not 
>> > > nothing, then I do a type assert to make sure the type is what I 
>> > > expected. 
>> > > 
>> > > Is there any function or macro in Julia that can help this? 
>> > > 
>> > > I know in F#, I have option.bind, so option.bind f x is equivalent 
>> > > to a pattern match:  if x is None - > None; if x is something -> 
>> > > f(something) 
>> > > 
>> > > Also in C#, I have "customers?[0]?.Orders?.Count();"  (as long as 
>> > > there is null before ?, it returns null immediately) 
>> > > 
>> > > Does Julia have something similar? 
>> > > 
>> > > 
>>
>

Re: [julia-users] Re: Nothing conditional operator

2016-03-21 Thread Milan Bouchet-Valat
Le dimanche 20 mars 2016 à 16:56 -0700, Jeffrey Sarnoff a écrit :
> Redis itself is written in C. They document GET key:
> > Get the value of key. If the key does not exist the special
> > value nil is returned. 
> 
> An error is returned if the value stored at key is not a string,
> because GET only handles string values.
>  
>  digging deeper
> > The client library API should not return an empty string, but a nil
> > object, when the server replies with a Null Bulk String. 
> 
> For example a Ruby library should return 'nil' while a C library
> should return NULL (or set a special flag in the reply object), and
> so forth.
> > Single elements of an Array may be Null. This is used in Redis
> > replies in order to signal that this elements are missing and not
> > empty strings. 
> 
> This can happen with the SORT command when used with the
> GET pattern option when the specified key is missing.
> 
> [For example, if the] second element is a Null. The client library
> should return something like this: ["foo", nil, "bar"]
> The Redis nil indicates a non-present value (missing or unavailable
> or, not extant: a domain|-> range error).
> From a semiotic viewpoint, Julia's nothing is closer to "absence"
> than it is to "an absent value"; of course
> the operational machinery supplies an actual entity to be nothing (a
> singleton realization ofthe type Void).
> 
> A much more contextual fit be the use of Nullable, although that may
> require more of the client; a simpler way
> to handle the Redis nil without doing something with nothing is to
> use a dedicated const symbol or a singleton
> to be that sentinel, perhaps:  
>  const RedisNil = :RedisNil# or
>  type RedisNIL end; RedisNil =
> RedisNIL()
> 
> Somewhere there are lengthy and informative discussions about Julia
> and nil / NULL / nothing.
> (I noted this thread to the Redis.jl project).
Interesting. Though this wouldn't be an actual sentinel, as a symbol is
a different type from a string, so type instability would remain.

It seems that Redis.jl has chosen to follow the Python API, which isn't
type-stable. In Julia, it could make sense to retain a type-stable
solution, i.e. always return a Nullable. This would be a good test to
check what improvements Julia needs to make working with Nullable
pleasant enough.

Actually, get() from Redis.jl is faced with the very same design issue
as get() from Julia Base. The latter raises an error when a key is
missing, and there's been discussions about offering an alternative
function which would return a Nullable:
https://github.com/JuliaLang/julia/issues/13055

I would argue that Redis.jl should follow the same pattern as Base for
consistency. It would be interesting to get comments from the package
author about this.


Regards


> 
> 
> 
> 
> > Redis.jl returns nothing when requesting a the value of a key that
> > doesn't exist:
> > 
> > using Redis
> > conn = RedisConnection()
> > r = get(conn, "non_existent_key")
> > disconnect(conn)
> > r == nothing    # true
> > 
> > 
> > > For now I don't know of a good solution to this pattern, but
> > > there's 
> > > been some discussion about it: 
> > > https://github.com/JuliaLang/julia/issues/15174 
> > > 
> > > You should definitely use a Nullable instead of returning
> > > nothing. 
> > > 
> > > 
> > > Regards 
> > > 
> > > Le samedi 19 mars 2016 à 02:58 -0700, Jeffrey Sarnoff a écrit : 
> > > > You may be misusing nothing.  It is unusual that a function
> > > would 
> > > > return nothing some of the time and something other times. 
> > > > Take a look at http://docs.julialang.org/en/latest/manual/faq/#
> > > nothin 
> > > > gness-and-missing-values 
> > > > If you have additional questions about this, please give an
> > > example 
> > > > of what get_a(...) is getting and why it would be nothing some
> > > of the 
> > > > time. 
> > > > 
> > > > > Hi All 
> > > > > 
> > > > > 
> > > > > I found my self writing code like this a lot: 
> > > > > 
> > > > > x = get_a(...) 
> > > > > 
> > > > > if x != nothing 
> > > > >     y::A = x 
> > > > >     do_sth(y, ...) 
> > > > > end 
> > > > > 
> > > > > In the above, I have to check for nothing first, and if it is
> > > not 
> > > > > nothing, then I do a type assert to make sure the type is
> > > what I 
> > > > > expected. 
> > > > > 
> > > > > Is there any function or macro in Julia that can help this? 
> > > > > 
> > > > > I know in F#, I have option.bind, so option.bind f x is
> > > equivalent 
> > > > > to a pattern match:  if x is None - > None; if x is something
> > > -> 
> > > > > f(something) 
> > > > > 
> > > > > Also in C#, I have "customers?[0]?.Orders?.Count();"  (as
> > > long as 
> > > > > there is null before ?, it returns null immediately) 
> > > > > 
> > > > > Does Julia have something similar? 
> > > > > 
> > > > > 


Re: [julia-users] Re: Nothing conditional operator

2016-06-18 Thread YB Israel
see my comment to https://github.com/jkaye2012/Redis.jl/issues/26

On Monday, March 21, 2016 at 11:40:38 AM UTC+2, Milan Bouchet-Valat wrote:
>
> Le dimanche 20 mars 2016 à 16:56 -0700, Jeffrey Sarnoff a écrit : 
> > Redis itself is written in C. They document GET key: 
> > > Get the value of key. If the key does not exist the special 
> > > value nil is returned.  
> > 
> > An error is returned if the value stored at key is not a string, 
> > because GET only handles string values. 
> >   
> >  digging deeper 
> > > The client library API should not return an empty string, but a nil 
> > > object, when the server replies with a Null Bulk String.  
> > 
> > For example a Ruby library should return 'nil' while a C library 
> > should return NULL (or set a special flag in the reply object), and 
> > so forth. 
> > > Single elements of an Array may be Null. This is used in Redis 
> > > replies in order to signal that this elements are missing and not 
> > > empty strings.  
> > 
> > This can happen with the SORT command when used with the 
> > GET pattern option when the specified key is missing. 
> > 
> > [For example, if the] second element is a Null. The client library 
> > should return something like this: ["foo", nil, "bar"] 
> > The Redis nil indicates a non-present value (missing or unavailable 
> > or, not extant: a domain|-> range error). 
> > From a semiotic viewpoint, Julia's nothing is closer to "absence" 
> > than it is to "an absent value"; of course 
> > the operational machinery supplies an actual entity to be nothing (a 
> > singleton realization ofthe type Void). 
> > 
> > A much more contextual fit be the use of Nullable, although that may 
> > require more of the client; a simpler way 
> > to handle the Redis nil without doing something with nothing is to 
> > use a dedicated const symbol or a singleton 
> > to be that sentinel, perhaps:   
> >  const RedisNil = :RedisNil# or 
> >  type RedisNIL end; RedisNil = 
> > RedisNIL() 
> > 
> > Somewhere there are lengthy and informative discussions about Julia 
> > and nil / NULL / nothing. 
> > (I noted this thread to the Redis.jl project). 
> Interesting. Though this wouldn't be an actual sentinel, as a symbol is 
> a different type from a string, so type instability would remain. 
>
> It seems that Redis.jl has chosen to follow the Python API, which isn't 
> type-stable. In Julia, it could make sense to retain a type-stable 
> solution, i.e. always return a Nullable. This would be a good test to 
> check what improvements Julia needs to make working with Nullable 
> pleasant enough. 
>
> Actually, get() from Redis.jl is faced with the very same design issue 
> as get() from Julia Base. The latter raises an error when a key is 
> missing, and there's been discussions about offering an alternative 
> function which would return a Nullable: 
> https://github.com/JuliaLang/julia/issues/13055 
>
> I would argue that Redis.jl should follow the same pattern as Base for 
> consistency. It would be interesting to get comments from the package 
> author about this. 
>
>
> Regards 
>
>
> > 
> > 
> > 
> > 
> > > Redis.jl returns nothing when requesting a the value of a key that 
> > > doesn't exist: 
> > > 
> > > using Redis 
> > > conn = RedisConnection() 
> > > r = get(conn, "non_existent_key") 
> > > disconnect(conn) 
> > > r == nothing# true 
> > > 
> > > 
> > > > For now I don't know of a good solution to this pattern, but 
> > > > there's  
> > > > been some discussion about it:  
> > > > https://github.com/JuliaLang/julia/issues/15174  
> > > > 
> > > > You should definitely use a Nullable instead of returning 
> > > > nothing.  
> > > > 
> > > > 
> > > > Regards  
> > > > 
> > > > Le samedi 19 mars 2016 à 02:58 -0700, Jeffrey Sarnoff a écrit :  
> > > > > You may be misusing nothing.  It is unusual that a function 
> > > > would  
> > > > > return nothing some of the time and something other times.  
> > > > > Take a look at http://docs.julialang.org/en/latest/manual/faq/# 
> > > > nothin  
> > > > > gness-and-missing-values  
> > > > > If you have additional questions about this, please give an 
> > > > example  
> > > > > of what get_a(...) is getting and why it would be nothing some 
> > > > of the  
> > > > > time.  
> > > > >  
> > > > > > Hi All  
> > > > > >  
> > > > > >  
> > > > > > I found my self writing code like this a lot:  
> > > > > >  
> > > > > > x = get_a(...)  
> > > > > >  
> > > > > > if x != nothing  
> > > > > > y::A = x  
> > > > > > do_sth(y, ...)  
> > > > > > end  
> > > > > >  
> > > > > > In the above, I have to check for nothing first, and if it is 
> > > > not  
> > > > > > nothing, then I do a type assert to make sure the type is 
> > > > what I  
> > > > > > expected.  
> > > > > >  
> > > > > > Is there any function or macro in Julia that can help this?  
> > > > > >  
> > > > > > I know in F#, I have option.bind, so option.bind f x

Re: [julia-users] Re: Nothing conditional operator

2016-06-29 Thread Yaakov Borstein


On Monday, March 21, 2016 at 1:56:34 AM UTC+2, Jeffrey Sarnoff wrote:
>
> Redis itself is written in C. They document GET key:
>
>> Get the value of key. If the key does not exist the special value nil is 
>> returned. 
>
> An error is returned if the value stored at key is not a string, because 
>> GET  only handles string values.
>
>  
>  digging deeper
>
>> The client library API should not return an empty string, but a nil 
>> object, when the server replies with a Null Bulk String. 
>
> For example a Ruby library should return 'nil' while a C library should 
>> return NULL (or set a special flag in the reply object), and so forth.
>
>
> Single elements of an Array may be Null. This is used in Redis replies in 
>> order to signal that this elements are missing and not empty strings. 
>
> This can happen with the SORT command when used with the GET *pattern* option 
>> when the specified key is missing.
>
> [For example, if the] second element is a Null. The client library should 
>> return something like this: ["foo", nil, "bar"]
>
>
> The Redis *nil* indicates a non-present value (missing or unavailable or, not 
> extant: a domain|-> range error).
>
> From a semiotic viewpoint, Julia's *nothing* is closer to "absence" than it 
> is to "an absent value"; of course
>
> the operational machinery supplies an actual entity to be *nothing* (a 
> singleton realization ofthe type Void).
>
>
> A much more contextual fit be the use of Nullable, although that may require 
> more of the client; a simpler way
>
> to handle the Redis *nil* without doing something with *nothing* is to use a 
> dedicated const symbol or a singleton
>
> to be that sentinel, perhaps:  
>
> * const RedisNil = :RedisNil# or*
>
>  *type RedisNIL end; RedisNil = RedisNIL()*
>
>
> *Somewhere there are lengthy and informative discussions about Julia and nil 
> / NULL / nothing.*
>
> *(I noted this thread to the Redis.jl project).*
>
>
>
>
>
>
>
> On Sunday, March 20, 2016 at 6:45:57 PM UTC-4, jock@gmail.com wrote:
>>
>> Redis.jl returns nothing when requesting a the value of a key that 
>> doesn't exist:
>>
>> using Redis
>> conn = RedisConnection()
>> r = get(conn, "non_existent_key")
>> disconnect(conn)
>> r == nothing# true
>>
>>
>> On Sunday, March 20, 2016 at 1:31:30 AM UTC+11, Milan Bouchet-Valat wrote:
>>>
>>> For now I don't know of a good solution to this pattern, but there's 
>>> been some discussion about it: 
>>> https://github.com/JuliaLang/julia/issues/15174 
>>>
>>> You should definitely use a Nullable instead of returning nothing. 
>>>
>>>
>>> Regards 
>>>
>>> Le samedi 19 mars 2016 à 02:58 -0700, Jeffrey Sarnoff a écrit : 
>>> > You may be misusing nothing.  It is unusual that a function would 
>>> > return nothing some of the time and something other times. 
>>> > Take a look at http://docs.julialang.org/en/latest/manual/faq/#nothin 
>>> > gness-and-missing-values 
>>> > If you have additional questions about this, please give an example 
>>> > of what get_a(...) is getting and why it would be nothing some of the 
>>> > time. 
>>> > 
>>> > > Hi All 
>>> > > 
>>> > > 
>>> > > I found my self writing code like this a lot: 
>>> > > 
>>> > > x = get_a(...) 
>>> > > 
>>> > > if x != nothing 
>>> > > y::A = x 
>>> > > do_sth(y, ...) 
>>> > > end 
>>> > > 
>>> > > In the above, I have to check for nothing first, and if it is not 
>>> > > nothing, then I do a type assert to make sure the type is what I 
>>> > > expected. 
>>> > > 
>>> > > Is there any function or macro in Julia that can help this? 
>>> > > 
>>> > > I know in F#, I have option.bind, so option.bind f x is equivalent 
>>> > > to a pattern match:  if x is None - > None; if x is something -> 
>>> > > f(something) 
>>> > > 
>>> > > Also in C#, I have "customers?[0]?.Orders?.Count();"  (as long as 
>>> > > there is null before ?, it returns null immediately) 
>>> > > 
>>> > > Does Julia have something similar? 
>>> > > 
>>> > > 
>>
>>
The latest merge resolves the issue of 'nil' in Redis.jl.


Re: [julia-users] Re: Nothing conditional operator

2016-06-29 Thread Jeffrey Sarnoff
Good. Perhaps this is appropriate as a template for others.

On Wednesday, June 29, 2016 at 6:24:35 PM UTC-4, Yaakov Borstein wrote:
>
>
>
> On Monday, March 21, 2016 at 1:56:34 AM UTC+2, Jeffrey Sarnoff wrote:
>>
>> Redis itself is written in C. They document GET key:
>>
>>> Get the value of key. If the key does not exist the special value nil is 
>>> returned. 
>>
>> An error is returned if the value stored at key is not a string, because 
>>> GET  only handles string values.
>>
>>  
>>  digging deeper
>>
>>> The client library API should not return an empty string, but a nil 
>>> object, when the server replies with a Null Bulk String. 
>>
>> For example a Ruby library should return 'nil' while a C library should 
>>> return NULL (or set a special flag in the reply object), and so forth.
>>
>>
>> Single elements of an Array may be Null. This is used in Redis replies in 
>>> order to signal that this elements are missing and not empty strings. 
>>
>> This can happen with the SORT command when used with the GET *pattern* 
>> option 
>>> when the specified key is missing.
>>
>> [For example, if the] second element is a Null. The client library 
>>> should return something like this: ["foo", nil, "bar"]
>>
>>
>> The Redis *nil* indicates a non-present value (missing or unavailable or, 
>> not extant: a domain|-> range error).
>>
>> From a semiotic viewpoint, Julia's *nothing* is closer to "absence" than it 
>> is to "an absent value"; of course
>>
>> the operational machinery supplies an actual entity to be *nothing* (a 
>> singleton realization ofthe type Void).
>>
>>
>> A much more contextual fit be the use of Nullable, although that may require 
>> more of the client; a simpler way
>>
>> to handle the Redis *nil* without doing something with *nothing* is to use a 
>> dedicated const symbol or a singleton
>>
>> to be that sentinel, perhaps:  
>>
>> * const RedisNil = :RedisNil# or*
>>
>>  *type RedisNIL end; RedisNil = RedisNIL()*
>>
>>
>> *Somewhere there are lengthy and informative discussions about Julia and nil 
>> / NULL / nothing.*
>>
>> *(I noted this thread to the Redis.jl project).*
>>
>>
>>
>>
>>
>>
>>
>> On Sunday, March 20, 2016 at 6:45:57 PM UTC-4, jock@gmail.com wrote:
>>>
>>> Redis.jl returns nothing when requesting a the value of a key that 
>>> doesn't exist:
>>>
>>> using Redis
>>> conn = RedisConnection()
>>> r = get(conn, "non_existent_key")
>>> disconnect(conn)
>>> r == nothing# true
>>>
>>>
>>> On Sunday, March 20, 2016 at 1:31:30 AM UTC+11, Milan Bouchet-Valat 
>>> wrote:

 For now I don't know of a good solution to this pattern, but there's 
 been some discussion about it: 
 https://github.com/JuliaLang/julia/issues/15174 

 You should definitely use a Nullable instead of returning nothing. 


 Regards 

 Le samedi 19 mars 2016 à 02:58 -0700, Jeffrey Sarnoff a écrit : 
 > You may be misusing nothing.  It is unusual that a function would 
 > return nothing some of the time and something other times. 
 > Take a look at http://docs.julialang.org/en/latest/manual/faq/#nothin 
 > gness-and-missing-values 
 > If you have additional questions about this, please give an example 
 > of what get_a(...) is getting and why it would be nothing some of the 
 > time. 
 > 
 > > Hi All 
 > > 
 > > 
 > > I found my self writing code like this a lot: 
 > > 
 > > x = get_a(...) 
 > > 
 > > if x != nothing 
 > > y::A = x 
 > > do_sth(y, ...) 
 > > end 
 > > 
 > > In the above, I have to check for nothing first, and if it is not 
 > > nothing, then I do a type assert to make sure the type is what I 
 > > expected. 
 > > 
 > > Is there any function or macro in Julia that can help this? 
 > > 
 > > I know in F#, I have option.bind, so option.bind f x is equivalent 
 > > to a pattern match:  if x is None - > None; if x is something -> 
 > > f(something) 
 > > 
 > > Also in C#, I have "customers?[0]?.Orders?.Count();"  (as long as 
 > > there is null before ?, it returns null immediately) 
 > > 
 > > Does Julia have something similar? 
 > > 
 > > 
>>>
>>>
> The latest merge resolves the issue of 'nil' in Redis.jl.
>