On Sun, Jan 31, 2016 at 4:25 PM, Bryan Rivera <futurehori...@gmail.com> wrote:
> Working on 0.5.0-dev+2422:
>
> julia> type SomeCallBack
>            z::Int
>        end
>
> julia> (_::SomeCallBack)(c) = _.z + c
>
> julia> s = SomeCallBack(24)
>
> SomeCallBack(24)
>
> julia> s(10)
>
> 34
>
> julia> @code_llvm s(10)
>
> define i64 @julia_SomeCallBack_23730(%jl_value_t*, i64) #0 {
>
> top:
>   %2 = bitcast %jl_value_t* %0 to i64*
>   %3 = load i64, i64* %2, align 16
>   %4 = add i64 %3, %1
>   ret i64 %4
> }
>
>
> I tried various combos with parametric types to no avail.
>
>

This is essentially the same with the code I had that **works**, what
does not work currently is

```
julia> abstract A

julia> (t::T){T<:A}() = t
ERROR: function type in method definition is not a type
```

which should be the equivalence of

```
julia> call{T<:A}(t::T) = t

WARNING: deprecated syntax "call(t::T, ...)".
Use "(t::T)(...)" instead.
ERROR: function type in method definition is not a type
```

As I mentioned, I agree that this itself won't be useful since the
type parameter can simply be replaced with the abstract type itself.
However, this would be useful if the type parameter is used somewhere
else too. e.g.

```
julia> (t::T){T<:A}(t2::T) = t
ERROR: function type in method definition is not a type
```

And this is why I think it's a bug.

Reply via email to