Re:CppCon 2018: Simplicity: Not Just For Beginners [video]
by pcwalton on Friday September 28, 2018 @01:51PM
(#18095412)
I'd argue that the C preprocessor is the closest thing C++ has to Lisp macros. Templates are fundamentally based on static types, which are obviously something Lisp doesn't have.
Re:CppCon 2018: Simplicity: Not Just For Beginners [video]
by pjmlp on Saturday September 29, 2018 @05:56AM
(#18099556)
That misses the point of duck typing in C++ templates, which is one of their great features, and also the cause of those wonderful instantiation error messages.
In Lisp the same error would be a runtime one.
Re:CppCon 2018: Simplicity: Not Just For Beginners [video]
by Yoric on Friday September 28, 2018 @01:56PM
(#18095463)
Well, the C preprocessor is a pretty far cry from the kind of power of Lisp macros. If you want something as powerful as Lisp macros (ish), there isn't much else you can use in C++ land.
Re:CppCon 2018: Simplicity: Not Just For Beginners [video]
by pjmlp on Saturday September 29, 2018 @06:43AM
(#18099690)
You can do quite a lot with if constepxr and TMO tricks, even stuff like generation of serialization code, even if isn't as clean as a Lisp implementation would be.
And who knows, maybe by C++23 some form of reflection will be finally available.
While it will never match the simplicity of Lisp, it is easier to get C++ accepted into most companies than Lisp.
And if one has access to a C++17 compiler, many tricks can now be replaced by more developer friendly constructs.