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)*
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
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)
>
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)
```
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)
> ```
>
>
>
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:
>>
>>