Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
This is alternative syntax that is there so one can write normal functions in the same style that one writes lambdas. To specify lambda return type you go: [] () -> int {}. It makes sense to give the option to write normal functions in the same way imo, even though I find it rather ugly.
-
There are some good reasons for it, but it has some fuxoring going on too:
https://blog.petrzemek.net/2017/01/... -
@Batburger Except that if you keep the syntaxes separate you have an easy visual way to tell the difference which is lost if normal functions can be written as lambdas. Perhaps it's not a big deal, but it seems like a potential source of future confusion/bugs to me.
-
orhun12475yI'm adding this rant to my favorites for reminding myself this very situation.
What the actual fuck is this? -
@Pyjong Heh, I used to play with C-- like 20 years ago when I couldn't afford a C compiler.
-
@powerfulparadox thats because simplicity of implementation is not the same thing as comprehensibility.
For an example of this cognitive bias, look at the design of LISP.
Everythings a list. Conceptually beautiful. In practice, less so. -
@Wisecrack Part of the problem is that purity and simplicity are not the same as understandability (especially when human minds are involved). Another part of the problem is syntax choice: bad syntax can make things harder to distinguish when good syntax can clarify exactly the same expression. (Lisp has problems with both of these to varying degrees.)
That's not to say that everything must be complex to be understandable. Plan 9 simplified the Unix design even further, and is probably the best OS design I've ever seen. But when it comes to programming languages, it seems that the more explicit the components of the language allow people to be the easier it is for programmers to express their programs clearly. The Turing machine has the simplest, purest possible programming language, but it's also one of the most difficult to comprehend a program in. -
I guess I should feel guilty for liking it? I dunno much about C++ in order to properly say if I like it or not :v
Related Rants
-
xjose97x19Just saw a variable in C named like this: long time_ago; //in a galaxy far away I laughed no stop.
-
linuxxx32*client calls in* Me: good morning, how can I help you? Client: my ip is blocked, could you unblock it for m...
-
DRSDavidSoft28Found this in our codebase, apparently one of my co-workers had written this
WTF C++?! I liked you, I defended you, I told people about you. Then you go and do shit like this:
int main(int argc, char* argv[])
to
auto main(int argc, char* argv[])->int
Seriously C++ WTF?!
rant
c++
new syntax
wtf