I think you want inheritance and vtables, not templates...
-
-
-
What I want is for ppl to stop writing stuff in C++. But until that happens, a way to make the result less hellish.
-
So a C++ compiler without template support would make you happy?
-
No because it couldn't compile any C++ programs, which is the only point of a C++ compiler. I don't want to *write* this hideous language. I want to compile stuff without it taking 100GB.
-
Ah well then I have no solution for you. I share your sensibilities re conservative resource usage.
End of conversation
New conversation -
-
-
Have you considered: any programming language with actually-thought-out generics? :P For example Rust allows you to control explicitly whether generics will give you static dispatch by duplicating code or dynamic dispatch at runtime.
-
I mean to compile existing C++ code with 5% of the resulting size and build-time resource requirements.
-
would be nice. or, maybe a compiler that does N direct expansions, and beyond this quietly falls back to treating it more like a dynamic language (ex: using a lot of tagged dynamic types and implicit conditional branches)?...
End of conversation
New conversation -
-
-
I tried to do something similar for Ada (not with runtime branches, but using actual-type-specific thunks passed by the caller). Sadly, Ada's generics break its "contract model": body determines legality of array use (constrained/unconstrained). It would otherwise have worked.
-
Having looked at C++ templates, though, I don't think there's a hope in hell of doing something similar for them (in general): they're really syntactic macros.
-
Just leave the AST in the output and include an AST interpreter. ;-)
-
That's not too far-fetched!
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.