Flexible @generate_jit specialization on @jitclasses types?

Hi there, I’m wondering if we can @generate_jit on @jitclass types (in a Julia’s “multiple dispatch” style). The following example

class A(object):
    def __init__(self):

class B(object):
    def __init__(self):

def fa(state):
    print("Found an A")

def fb(state):
    print("Found a B")

def fc(state):
    print("Found an unknown")

def func(state):
    if isinstance(state, A):
        return fa
    elif isinstance(state, B):
        return fb
        return fc


just prints

Found an unknown
Found an unknown

I’ve tried also to use


in the isinstance calls but it doesn’t help.

Cheers !

it seems to me this should work… when I use just the two class definitions and add

print(isinstance(A(), A))

returns True for me.
maybe try @overload?

Yes it works in python mode but not inside a jit function, and raises a

Untyped global name 'isinstance': cannot determine Numba type of <class 'builtin_function_or_method'>

This might explain what @generated_jit does not work with this.
If I understand well, this might come from the fact that jitclass really are experimental, and not really a “class” per se but rather implemented as a function (constructor)… But my understanding stops there