3 ms·
If you think of cpy as high level glue code for "pure" c++ functions, this might work. I don't like decisions like implicit << and >> for cin, cout. Too much m
by cjalmeida 8y ago
If you think of cpy as high level glue code for "pure" c++ functions, this might work.
I don't like decisions like implicit << and >> for cin, cout. Too much magic for me.
- drenvuk 8y agoHonest question, why do you consider implicit << and >> for cin,cout to be too much magic?
- saagarjha 8y agoIt's a misappropriation of an operator. C had a "definition" for them, and this completely disregards that definition. It's one of the biggest things people cry about when custom operators are brought up in other languages, because C++ really dropped the ball here in using operators in a sane way.
- kevin_thibedeau 8y agoAnd yet we had a few decades of magic 0 literals that transmute into pointers until we finally got a proper nullptr. There's some grade A impurity built directly into the core language and hard to avoid unlike the std lib.
- cjalmeida 8y agoIMO, the usefulness of things like CPY is being easy to read, without too much noise or boilerplate. (cout "hello") confuses the hell out of those with some C++ experience. It changes semantics if a known object for little gain (cout is callable, a statement)? Like someone else said, a "printout" new statement or function would be better. It's the kind of things that makes me question the design of the whole language.
- jakear 8y agoYeah that implicit operator insertion is a bit odd... but things like automatically inserting an "auto" into declarations seems fair. I'd prefer maintaining "this->" to the "known" keyword.
- Lorkki 8y agoYeah, it would make more sense to just add the new line printing shorthands and leave cin/cout/cerr alone. Overloading "for" as a loop over a range of integers also seems questionable, and it seems you'd need to pollute the scope outside of the loop each time you don't want to start from 0.