6 ms·
My guess you apply your experience with some bizarre language (PHP?) to C, which you never learned. C and C++ are internally consistent in the same way a math t
by pandaman 13y ago
My guess you apply your experience with some bizarre language (PHP?) to C, which you never learned. C and C++ are internally consistent in the same way a math theory is. Many programming languages are not, indeed.
> You could make many different tiny changes to the rules of C and still end up with a workable programming language. (Many people have done that, there are tons of languages derived from C.)
Coincidentally, same is Math. I give you Euclid's Fifth postulate as an example.
>You could say that the rules of C are "random" - after learning the first n rules, you cannot use logic to predict the n+1st.
This depends on how do you enumerate these rules. If you learn that auto variables are allocated on the stack it's easy to predict that you cannot return their addresses and there are not going to be default initializes for them.
- mden 13y agoI think the point was that mathematics relies on a small set of postulates from which you can derive everything else. Changing a postulate results in a separate system. The same is true in programming languages, but the number of postulates is very large compared to mathematics to the point that their utility is greatly reduced. And also there are so many languages each with its own postulate set that it's really inelegant when compared to mathematics. Another way to put it is, learning the postulates for langx doesn't provide enough value for many to be worth doing.
- pandaman 13y ago>I think the point was that mathematics relies on a small set of postulates from which you can derive everything else. And I agree, this is one of the assertions my opponent has made. I did not go to refute it because, if not outright false, it's disingenuous. >Another way to put it is, learning the postulates for langx doesn't provide enough value for many to be worth doing. This is also true, same goes for everything else. I make money using C - I learn C's postulates. If somebody paid me to use topology - I'd learned topology postulates. What would be stupid if I were paid to use topology but said: "it's hard to learn and it makes no sense for me because I don't like mathematics and don't know any other math discipline so why would I all of sudden learn topology's postulate when I can copy formulas from the net and ask questions on manifoldoverflow.com?"
- pessimizer 13y agoTrying to derive C from its postulates is like trying to derive 70s television from its postulates. Most of C is an accident of history.
- pandaman 13y agoI am not sure what is your point now. Are you aware that most of the math is way older than C?
- pkolaczk 13y agoSaying that C++ is internally consistent at all is a huge exaggeration. Actually I'd be very careful with stating it is more consistent than PHP. Both have many sharp-edges and in both there are plenty of features that feel "tacked on" and are non-orthogonal to each other. E.g. why I can't make a generic (template) function virtual or why I cannot overload some overloadable operators to have exactly same semantics as the builtin ones.
- pjmlp 13y agoIn C++'s case "The Design and evolution of C++" is a good read to understand how the language turnout that way and why certain compromises were done.
- pkolaczk 13y agoSure, all the inconsistencies have a nice explanation, I never questioned that. PHPs === operator has a nice explanation, too.
- nly 13y agoYou can't make a member function template virtual because it's just a template, the function doesn't exist until it's statically instantiated. Instantiation can happen across units of compilation, making it impossible for the compiler to generate a vtable with all the instantiations within it. It's not a "tacked on" feature/limitation at all, and I don't see how any statically typed language that allowed function overloading could really work around that issue. I'm not sure what you mean about the operator overloading thing.
- pkolaczk 13y agoThis was a rhetoric question. I perfectly know why I can't do that in C++. C++ does not allow this because of particular generics implementation (done by static compile-time macro expansion), not because those two features are inherently contradictory. In fact, they are completely orthogonal and Java/Scala/C# have no problems with that, despite being statically typed.
- 13y ago