[julia-users] `methodswith` on `Union` types

2014-11-30 Thread Ethan Anderes


I’m not sure if this is a bug or not but methodswith doesn’t seem to work 
on Union types.
I came across this working with a linear fit in the GLM package

using GLM, DataFrames
lmfit = lm(y ~ x, DataFrame(x=[1,2,3], y=[2,3,3]))
methodswith(typeof(lmfit))

Here is a minimal working example

julia type Type1
   x
   end

julia type Type2
   x
   y
   end

julia foo(t::Union(Type1, Type2)) = t.x
foo (generic function with 1 method)

julia foo(Type1(10))
10

julia methodswith(Type1)
0-element Array{Method,1}

Here is my version info

julia versioninfo()
Julia Version 0.3.4-pre+2
Commit 9f76ed3 (2014-11-24 17:47 UTC)
Platform Info:
  System: Darwin (x86_64-apple-darwin14.0.0)
  CPU: Intel(R) Core(TM) i7-4850HQ CPU @ 2.30GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
  LAPACK: libopenblas
  LIBM: libopenlibm
  LLVM: libLLVM-3.3

​


Re: [julia-users] `methodswith` on `Union` types

2014-11-30 Thread Mauro
Yep, you should file an issue if one doesn't exist yet.

On Sun, 2014-11-30 at 17:02, Ethan Anderes ethanande...@gmail.com wrote:
 I’m not sure if this is a bug or not but methodswith doesn’t seem to work 
 on Union types.
 I came across this working with a linear fit in the GLM package

 using GLM, DataFrames
 lmfit = lm(y ~ x, DataFrame(x=[1,2,3], y=[2,3,3]))
 methodswith(typeof(lmfit))

 Here is a minimal working example

 julia type Type1
x
end

 julia type Type2
x
y
end

 julia foo(t::Union(Type1, Type2)) = t.x
 foo (generic function with 1 method)

 julia foo(Type1(10))
 10

 julia methodswith(Type1)
 0-element Array{Method,1}

 Here is my version info

 julia versioninfo()
 Julia Version 0.3.4-pre+2
 Commit 9f76ed3 (2014-11-24 17:47 UTC)
 Platform Info:
   System: Darwin (x86_64-apple-darwin14.0.0)
   CPU: Intel(R) Core(TM) i7-4850HQ CPU @ 2.30GHz
   WORD_SIZE: 64
   BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
   LAPACK: libopenblas
   LIBM: libopenlibm
   LLVM: libLLVM-3.3

 ​



Re: [julia-users] `methodswith` on `Union` types

2014-11-30 Thread Ethan Anderes


Ok, thanks. I posted the issue here 
https://github.com/JuliaLang/julia/issues/9203.

On Sunday, November 30, 2014 11:09:11 AM UTC-8, Mauro wrote:

Yep, you should file an issue if one doesn't exist yet. 

 On Sun, 2014-11-30 at 17:02, Ethan Anderes ethana...@gmail.com 
 javascript: wrote: 
  I’m not sure if this is a bug or not but methodswith doesn’t seem to 
 work 
  on Union types. 
  I came across this working with a linear fit in the GLM package 
  
  using GLM, DataFrames 
  lmfit = lm(y ~ x, DataFrame(x=[1,2,3], y=[2,3,3])) 
  methodswith(typeof(lmfit)) 
  
  Here is a minimal working example 
  
  julia type Type1 
 x 
 end 
  
  julia type Type2 
 x 
 y 
 end 
  
  julia foo(t::Union(Type1, Type2)) = t.x 
  foo (generic function with 1 method) 
  
  julia foo(Type1(10)) 
  10 
  
  julia methodswith(Type1) 
  0-element Array{Method,1} 
  
  Here is my version info 
  
  julia versioninfo() 
  Julia Version 0.3.4-pre+2 
  Commit 9f76ed3 (2014-11-24 17:47 UTC) 
  Platform Info: 
System: Darwin (x86_64-apple-darwin14.0.0) 
CPU: Intel(R) Core(TM) i7-4850HQ CPU @ 2.30GHz 
WORD_SIZE: 64 
BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell) 
LAPACK: libopenblas 
LIBM: libopenlibm 
LLVM: libLLVM-3.3 
  
  ​ 

 ​