Skip to content
Franco Montenegro edited this page Jun 1, 2016 · 1 revision

Generics

Generics are in a very early stage so probably there are a couple of bugs on them.

struct List<E>
    public method add takes E whichElement
        // ...
    end
end

function foo
    local List<unit> unitList = List.create() // or any allocator
    
    call unitList.add(CreateUnit(...))
    call unitList.add(42) // ERROR: Element <whichElement> must have/return a value of type <unit> but given <integer>
end
Clone this wiki locally