Open chtenb opened 6 days ago
Unfortunately this is a pretty hard thing to fix.
We don't want to mangle all the names in the program, because that would make C interop harder. At the same time, we do have some c definitions already. So you just happened to give your function a name that translates to kk_vector_empty
(kk + file name + definition name). which is already defined in our core libraries for use with the unit/vector constructor:
// Create an empty vector.
pub inline extern unit/vector : forall<a> () -> vector<a>
c inline "kk_vector_empty()"
cs inline "new ##1[0]"
js inline "[]"
To fix this we have a few options:
Both of the last two are possible, but would require lots of renaming and fixing our extern definitions, or a large initial effort to document all C definitions, and a continual effort to keep that list maintained. (Also we have no guarantee that other people won't add their own C libraries and extern definitions that might conflict).
pub val empty : forall<a> vector<a> = unit/vector()
(Changing the name of the file, or adding a qualifier to
empty
makes the error disappear)