Sam's answer is spot on and pretty much what I would have recommended. A couple of things to note. Unlike Ruby and Python, method definitions don't belong to a particular type and it's not idiomatic to make a module (namespace) per type. Modules tend to be a bit broader and are used to collect a bunch of related types and generic functions which can all live at the top level in the module. This bugs some people, but I think it's pretty easy to work with. The one bit of awkwardness here is that there is no way (currently) to create a generic function in a particular module without adding methods to it. Sam's solution to this is to do
something(::Person) = error("not implemented") You can customize this to say something like "subtypes of Person must implement something" or whatever. 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 >