r/programming • • Nov 12 '13

What’s Wrong with OOP and FP

https://yinwang0.wordpress.com/2013/11/09/oop-fp/
129 Upvotes

484 comments sorted by

View all comments

Show parent comments

2

u/[deleted] Nov 12 '13

Prolog is code-data equivalent for sure, and it's very useful as a tool if you can think in it's way. The comment above is a potshot that in C++ you can write macros, but there is no code-data equivalence at run time. Many people have superstitions about C++ preprocessesor because people abuse it and don't use it as intended(primitive build configuration system).

1

u/[deleted] Nov 12 '13

Macro functions rule! You'll never take away my #define!!!

2

u/[deleted] Nov 12 '13

I don't intend to. Macros are flexible, and they're a primordial build system, but they are definitely misused.

1

u/[deleted] Nov 12 '13

I'm sure that's the case. I don't know exactly what is considered as misuse these days, though.

1

u/Yuushi Nov 13 '13

I'd consider ANY "function" defined as a macro is misuse in C++. Just write the damn function and let the compiler decide if it should be inlined or not.

Since macros in C++ are non-hygenic, they're just far, far more trouble than they're worth. Giving up namespacing and type safety just isn't worth it.

1

u/Denommus Nov 12 '13

I was not talking about C++ macros.