Re:An Introduction to Reflection in C++
by dasloop on Saturday April 15, 2017 @01:33PM
(#14121749)
What I want is a language over C++, as typescript is over JavaScript, that keeps compatibility with C and C++ code (Qt, boost...) and provides a clear syntax and some advanced features (as reflection) even paying a price for it. This is it, no more zero cost abstraction.
[ Parent
| on HN ]
I'm doing that but it's more a CoffeScript than a Typescript (no semicolons and no commas).
An example:
fn add(x1 x2)
{
return <x1+x2>
}
fn <main>(count:int arguments:<const char** const>):int
{
(<printf> "%d\n" (add 2 3))
return 0
}
Is converted to: auto add(const auto x1,const auto x2)
{
return x1+x2;
}
int main(const int count, const char** const arguments)
{
printf("%d\n",add(2,3));
return 0;
}
Everything inside the <angle brackets> is left as is in the C++ output.I use S-expressions for function calls.
Re:An Introduction to Reflection in C++
by smitherfield on Saturday April 15, 2017 @03:37PM
(#14122447)
Cython? http://cython.org
Yes, it supports C++ (even templates!): http://docs.cython.org/en/latest/src/userguide/wrapping_CPlu...
Re:An Introduction to Reflection in C++
by DerDangDerDang on Saturday April 15, 2017 @05:31PM
(#14122960)
The closest thing I can think of would be the subset of C++ used in Stepanov + McJones' Elements of Programming, with the addition C++11 stuff like lambdas and std::function, plus (hopefully) C++20 stuff like compile-time reflection, concepts and ranges.
Re:An Introduction to Reflection in C++
by NotSammyHagar on Saturday April 15, 2017 @02:06PM
(#14121917)
That is a great idea and great metaphor to describe your new language.
Like D?
No, D is a separate language. A bit too much. Ideally you will be able to move between a version of the language or another at Class level to alllow a incremental migration of the code that must be "modernized".