Hello,
I've been experimenting with the @jitclass decorator and have a small question: is it possible to compile a class that contains a List of another class?
Perhaps some code will illustrate my example:
```
import numpy as np
import numba as nb
from collections import OrderedDict
arc_type = nb.deferred_type()
spec = OrderedDict()
spec['vertex_id'] = nb.int32
spec['outgoing_arcs'] = nb.types.List(arc_type)
spec['incoming_arcs'] = nb.types.List(arc_type)
@nb.jitclass(spec)
class Vertex(object):
def __init__(self, vertex_id):
self.vertex_id = vertex_id
self.outgoing_arcs = []
self.incoming_arcs = []
spec = OrderedDict()
spec['from_vertex'] = Vertex.class_type.instance_type
spec['to_vertex'] = Vertex.class_type.instance_type
@nb.jitclass(spec)
class Arc(object):
def __init__(self, from_vertex, to_vertex):
self.from_vertex = from_vertex
self.to_vertex = to_vertex
from_vertex.outgoing_arcs.append(self)
to_vertex.incoming_arcs.append(self)
arc_type.define(Arc.class_type.instance_type)
```
This first bit of code runs, no trouble. But I cannot instantiate any `Vertex` objects:
```
```
This gives me an error right away :
```
TypingError: Failed at nopython (nopython frontend)
Failed at nopython (nopython frontend)
Can't infer type of variable '$0.3': list(undefined)
[1] During: resolving callee type: jitclass.Vertex#6b54ee8<vertex_id:int32,outgoing_arcs:list(DeferredType#131898280),incoming_arcs:list(DeferredType#131898280)>
[2] During: typing of call at <string> (3)
```
Am I attempting the impossible? Or did I just miss something in my code?Enter code here...
Thanks,
Peter Kucirek