This is toy problem that came up in the context of something larger,
reduced to be simple so that I can ask about it more easily.

Suppose I want to implement the function

is_instanceof_datatype(x) = is(typeof(x),DataType)

using dispatch: a default method that is

is_instanceof_datatype(x) = false

and some other method which only gets called when x is an instance of a
DataType:

is_instanceof_datatype{ ... }(x::T) = true # how to dispatch

but I don't know how to do the latter, hence the ....

The context is that I want to write a method that, for instances of
DataTypes, returns the slots in a given order, but for other values it
does something else, and I don't know how to do this.

Best,

Tamas

Reply via email to