6 ms·
This suggests that large parts of C/C++ can be 'simplified', which I think is a falacy, resulting in CPY to be a proper subset of C/C++. Already the introductio
by fjfaase 8y ago
This suggests that large parts of C/C++ can be 'simplified', which I think is a falacy, resulting in CPY to be a proper subset of C/C++. Already the introduction of a keyword like 'known' shows that the simplification is not as simple. I suspect that many new keywords needs to be added to support the full scope of C/C++ within CPY.
- cjalmeida 8y agoIf 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.
- hzhou321 8y agoWithin a local context (where corner cases can be excluded) large parts of C/C++ can be simplified. Expand to a general context, I think too it is a fallacy. Even when in theory the compile time can determine all the types and ambiguity, including all the corner cases makes learning the language very complicated. However, as a preprocessor, it does not need to work beyond local context as C/C++ is still there to deal with general corner cases.
- UncleEntity 8y ago> Already the introduction of a keyword like 'known' shows that the simplification is not as simple. Don't think that one is actually needed, simple static analysis should be able to tell one variable is just an alias of another -- which (presumably) they already do to figure out the variable types. The reasoning behind it is also kind of confusing, used to tell the preprocessor the variable is in local scope as opposed to...? --edit-- Or maybe it's used for class local variables?
- Yoric 8y agoI actually suspect that `known` solves an existing problem of C++, in which you can't be sure whether a name is that of an argument, a local variable or a field. Problem solved (at least partially) in other languages by requesting the `this` or `self` to be explicitly mentioned.