[julia-users] Re: isnull woes

2015-03-15 Thread Avik Sengupta

I think while a Java Null and Nullable Null are different, asking the 
question isnull is  a similar enough concept to deserve the same 
function. The Base/Nullable method is isnull(::Nullable), while the 
JavaCall method is isnull(::JavaObject{T}) .. which is the way it should 
be, afaics. It's only my wish to write a package that works accross 0.3 and 
0.4 that introduces the problem. 


On Saturday, 14 March 2015 11:14:58 UTC, Toivo Henningsson wrote:

 Do we consider nullness of java objects and nullables to be similar enough 
 that they should actually be checked with the same predicate? I guess the 
 two concepts do have a lot of things in common, though methods written to 
 work with nullables might not be prepared to accept java objects.



[julia-users] Re: isnull woes

2015-03-13 Thread Calvin Pritchard
 You could conditionally use Compat. Something like

module Foo
export isnull
if Base.VERSION  v0.4
  using Compat
  import Compat: isnull
else
  import Base: isnull
end
# new method for isnull  
end

should work.



On Friday, March 13, 2015 at 8:54:55 AM UTC-7, Avik Sengupta wrote:


 So JavaCall has always had an isnull(::JavaObject) method, which is 
 exported. 

 Now that Base has Nullable in v0.4, it also has an isnull(::Nullable) 
 method exported. 

 So far so good. But I want to use Compat for JavaCall, primarily for the 
 Int/int change. Now, Compat also has an isnull(::Nullable) method exported, 
 but that is in the module Compat!

 So I cant figure out how to write the definition of isnull in JavaCall, 
 that'll work in all versions of Julia. 

 Any help appreciated. 

 Regards
 -
 Avik

 PS Maybe this is another reason why new functionality should NOT be 
 backported, even in compat?



[julia-users] Re: isnull woes

2015-03-13 Thread elextr
Regarding the PS, just because it possibly causes problems in one edge case 
is no reason to not make backports available to assist in making code run 
across multiple versions, to assist in porting, and to keep packages 
running on stable Julia.  The benefits far outweigh the occasional cost, 
sorry you might have got hit with the cost.

Cheers
Lex

On Saturday, March 14, 2015 at 1:54:55 AM UTC+10, Avik Sengupta wrote:


 So JavaCall has always had an isnull(::JavaObject) method, which is 
 exported. 

 Now that Base has Nullable in v0.4, it also has an isnull(::Nullable) 
 method exported. 

 So far so good. But I want to use Compat for JavaCall, primarily for the 
 Int/int change. Now, Compat also has an isnull(::Nullable) method exported, 
 but that is in the module Compat!

 So I cant figure out how to write the definition of isnull in JavaCall, 
 that'll work in all versions of Julia. 

 Any help appreciated. 

 Regards
 -
 Avik

 PS Maybe this is another reason why new functionality should NOT be 
 backported, even in compat?