Re: [julia-users] How to get untemplated typename?

2016-01-05 Thread Sheehan Olver
Thanks! you do need the .primary: *julia> **typeof(f).name(4.0)* *ERROR: MethodError: `call` has no method matching call(::TypeName, ::Float64)* Closest candidates are: BoundsError() BoundsError(*::Any...*) DivideError() ... *julia> **typeof(f).name.primary(4.0)*

Re: [julia-users] How to get untemplated typename?

2016-01-05 Thread Jeffrey Sarnoff
Yes, you do need the .primary to make a maker. My mistake, I did not notice the last part of your question. julia> immutable Foo{D} x::D end julia> onefoo=Foo(1) Foo{Int64}(1) julia> thePartYouWant(x) = typeof(x).name thePartYouWant (generic function with 1 method) julia> this

Re: [julia-users] How to get untemplated typename?

2016-01-04 Thread Jeffrey Sarnoff
try Foo.name (without the '.primary'), and as Mauro says (try not to use it much) On Monday, January 4, 2016 at 5:39:53 AM UTC-5, Mauro wrote: > > This should do the trick: > > Foo.name.primary > > (I think this defeats type inference, so try not to use it in > performance critical code) >

[julia-users] How to get untemplated typename?

2016-01-04 Thread Sheehan Olver
If I have a type ```julia immutable Foo{D} x::D end f=Foo(5) ``` then `typeof(f)` gives me `Foo{Int}`. Is it possible to get access to just `Foo`? I.e., I want to do: ``` F=droptemplates(typeof(f)) # returns pointer to Foo F(1.0) ```

Re: [julia-users] How to get untemplated typename?

2016-01-04 Thread Mauro
This should do the trick: Foo.name.primary (I think this defeats type inference, so try not to use it in performance critical code) On Mon, 2016-01-04 at 11:31, Sheehan Olver wrote: > If I have a type > > ```julia > immutable Foo{D} > x::D > end > > f=Foo(5) > ``` > > >

Re: [julia-users] How to get untemplated typename?

2016-01-04 Thread Jeffrey Sarnoff
I meant: typeof(f).name On Monday, January 4, 2016 at 6:27:43 AM UTC-5, Jeffrey Sarnoff wrote: > > try Foo.name (without the '.primary'), and as Mauro says (try not to use > it much) > > > On Monday, January 4, 2016 at 5:39:53 AM UTC-5, Mauro wrote: >> >> This should do the trick: >> >>