apoch / epoch-language

Home of the Epoch Programming Language Project
Other
72 stars 3 forks source link

Higher order functions and template functions do not play nice together #156

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Test case:

type listnode<type T> : list<T> | nothing

structure list<type T> :
    T value,
    listnode<T> next

prepend<type T> : list<T> ref thelist, T value
{
    list<T> newlist = value, thelist
    thelist = newlist
}

map<type T> : list<T> ref thelist, (func : T)
{
    func(thelist.value)
    map(thelist.next, func)
}

map<type T> : nothing, (func : T)
{
}

The func() call in map() causes an internal compiler error, and the actual 
matching function doesn't seem to be recognized as a viable overload (T isn't 
mapped to the right type when doing signature checks I think).

Original issue reported on code.google.com by don.ap...@gmail.com on 22 Apr 2013 at 6:47

GoogleCodeExporter commented 9 years ago
This is slightly improved but the map() function now vomits at runtime since it 
can't find the correct type dispatch overloads in the recursive call.

Original comment by don.ap...@gmail.com on 23 Apr 2013 at 5:09

GoogleCodeExporter commented 9 years ago
Fixed in trunk.

Original comment by don.ap...@gmail.com on 24 Apr 2013 at 6:48