It's maybe not quite what you're looking for, but Cforall's polymorphic functions can eliminate nearly-all the unsafety of void-pointer-based polymorphism at little-to-no extra runtime cost (in fact, microbenchmarks in our as-yet-unpublished paper show speedup over void-pointer-based C in most cases due to more efficient generic type layout). As an example:
forall(dtype T | sized(T))
T* malloc() { // in our stdlib
return (T*)malloc(sizeof(T)); // calls libc malloc
}
int* i = malloc(); // infers T from return type
RhysU|8 years ago
enriquto|8 years ago
unknown|8 years ago
[deleted]
seabrookmx|8 years ago
A new GCC or LLVM frontend, or is it a transpiles-to-C implementation ala. Nim or Vala?
BruceIV|8 years ago
baybal2|8 years ago
BruceIV|8 years ago