Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

sepples

Name: Anonymous 2009-12-07 21:12

In general, I have to admit that I’m a little bit scared of language features that hide things. When you see the code

i = j * 5;

… in C you know, at least, that j is being multiplied by five and the results stored in i.

But if you see that same snippet of code in C++, you don’t know anything. Nothing. The only way to know what’s really happening in C++ is to find out what types i and j are, something which might be declared somewhere altogether else. That’s because j might be of a type that has operator* overloaded and it does something terribly witty when you try to multiply it. And i might be of a type that has operator= overloaded, and the types might not be compatible so an automatic type coercion function might end up being called. And the only way to find out is not only to check the type of the variables, but to find the code that implements that type, and God help you if there’s inheritance somewhere, because now you have to traipse all the way up the class hierarchy all by yourself trying to find where that code really is, and if there’s polymorphism somewhere, you’re really in trouble because it’s not enough to know what type i and j are declared, you have to know what type they are right now, which might involve inspecting an arbitrary amount of code and you can never really be sure if you’ve looked everywhere thanks to the halting problem (phew!).

When you see i=j*5 in C++ you are really on your own, bubby, and that, in my mind, reduces the ability to detect possible problems just by looking at code.

None of this was supposed to matter, of course. When you do clever-schoolboy things like override operator*, this is meant to be to help you provide a nice waterproof abstraction. Golly, j is a Unicode String type, and multiplying a Unicode String by an integer is obviously a good abstraction for converting Traditional Chinese to Standard Chinese, right?

Name: Anonymous 2009-12-08 15:54

>>39
As true as that is, it speaks nothing for the problem of not knowing the type. (If it weren't possible to be ignorant of the type, I don't think many people would care about C++. Scary thought.)

Name: Anonymous 2009-12-08 16:17

>>39
It's retarded. If you want to make your own language, use a lisp.

Name: Anonymous 2009-12-08 22:47

>>39
This just highlights how dumb operators and dot-style method calls are.

Name: Anonymous 2009-12-08 23:13

>>43
This. Of course operator overloading looks better than sepples pointer method dispatch.

The bigger problems are infix notation and the lack of multiple dispatch. Where are the lispfags advocating plus(a, b)?

Name: Anonymous 2009-12-08 23:50

>>43
Haha, agreed.  I think we can all agree that it we can be thankful it isn't shitty Lisp style, though.

Name: Anonymous 2009-12-09 1:33

>>45
Even Lisp the way Ctarded newbies write it is better than the sort of thing you like, whatever that may be.

Name: Anonymous 2009-12-09 2:36

(map high-five (map prog-quote '(42 43 44 46)))

Name: Anonymous 2009-12-09 2:43

>>42-44,46,47
Make it less obvious when you multipost in the future!

Name: Anonymous 2009-12-09 3:28

>>48
Be more correct when you assume in the past!

Name: Anonymous 2009-12-09 9:30

>>49
CORRECT MY ANUS

Name: ​​​​​​​​​​ 2010-10-22 10:44

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List