On Wed, May 20, 2015 at 6:43 PM, Josh Langsfeld <[email protected]> wrote:
> Ideally, I would like to write
>
> func{N::Int}(::Type{Val{N}) = N
>
> and get no-method errors if N is a float, symbol, etc... Has there been
> previous discussion on this topic?

According to this comment[1], this have been brought up but not yet implemented.

[1] https://github.com/JuliaLang/julia/issues/9580#issuecomment-101539298

>
> On Wednesday, May 20, 2015 at 5:28:26 PM UTC-4, Josh Langsfeld wrote:
>>
>> I want to implement some functionality in multiple methods and have the
>> dispatch controlled by an Int variable "N". The trick is I want one method
>> to be called if N == 0 and another one to be called for all other values of
>> N. Is there a way I can do this with "Val{N}" without making the method
>> applicable to everything? That is, can I write a generic method
>> "func(::Val{N}) and constrain N to be an Int only?

Reply via email to