I kind of like this approach, though -- if it feels wacky, that may be
just because Julia is a young language. If this became a convention
(like non-nil being true in some Lisps, or 0s terminating strings in C),
in the long run it may not feel so wacky.

I prefer this to introducing a construct just for defining a generic
function with no methods. Tools (IDEs etc) could be tweaked to silently
ignore methods with this signature.

Best,

Tamas

On Sun, Dec 14 2014, Stefan Karpinski <ste...@karpinski.org> wrote:

> If you really wanted a no method error here, you could define a method
> that can't possibly be invoked, such as this one:
>
> something(::Union()) = nothing
>
>
> That's a one-argument method whose argument is an element of the union of
> no types – i.e. the "bottom" or empty type. Since on values match this
> signature, this method cannot be called. This is a pretty hacky way to do
> this and we should probably just have an official way of creating a new
> generic function with no methods.
>
> On Fri, Dec 12, 2014 at 11:03 PM, Charles Snider <cjsn...@gmail.com> wrote:
>
>> Very cool Sam!
>>
>> Julia is new to me, but I really like ruby and was trying to do things I
>> would do in ruby in julia, just didn't know how.
>> This sheds all new light on the language!
>>
>> I really appreciate you taking your time to look at this, really very
>> helpful.
>>
>> Thank you,
>>
>> - Charlie
>>

Reply via email to