Re:Proving that C++'s grammar is undecidable
by chubot on Tuesday April 28, 2020 @11:54PM
(#23015162)
What bugs me is that you don't even need to use templates to run into syntax traps. Braced initialization is crazy and I don't understand it (having first touched C++ sometime in the 90's, done it professionally, and even writing in my own pidgin subset now)
https://twitter.com/timur_audio/status/1119160309573242880?l...
I can understand having crazy syntax for rare and exotic things. But variable initialization is not one of those things...
Re:Proving that C++'s grammar is undecidable
by kllrnohj on Wednesday April 29, 2020 @01:03AM
(#23015560)
> Braced initialization is crazy and I don't understand it
It's a disambiguation thing: https://en.wikipedia.org/wiki/Most_vexing_parse
The simple recommendation is to just always use {} when you want to construct an object, see https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines...
Re:Proving that C++'s grammar is undecidable
by saagarjha on Wednesday April 29, 2020 @01:52AM
(#23015836)
Unfortunately itβs not perfect and can do strange or undesirable things sometimes, especially when interacting with auto.
Re:Proving that C++'s grammar is undecidable
by kllrnohj on Wednesday April 29, 2020 @11:56AM
(#23020692)
C++17 improved the auto situation. It looks pretty much as I'd expect now.
Re:Proving that C++'s grammar is undecidable
by gumby on Tuesday April 28, 2020 @11:28PM
(#23014991)
I'm not sure what you mean by heavy use of keywords, but C++20 allows you to express templates basically as generics so if the <> syntax offends you you can do without it completely.
Do you also object to Lisp Macros?
Re:Proving that C++'s grammar is undecidable
by jonny383 on Wednesday April 29, 2020 @12:32AM
(#23015391)
This is exactly the problem with C++. Let's fix ugly syntax by providing yet another way to write something that accomplishes the same thing.
Over-evolution isn't a good thing.
Re:Proving that C++'s grammar is undecidable
by pjmlp on Wednesday April 29, 2020 @02:29AM
(#23016063)
Just like breaking backwards compatibility usually leads to 17 years delay in adoption. Can't please everyone.
Re:Proving that C++'s grammar is undecidable
by teleforce on Wednesday April 29, 2020 @02:23AM
(#23016036)
Not OP but D has better templates implementation [1] and it has no macros, yeay!
Re:Proving that C++'s grammar is undecidable
by gumby on Wednesday April 29, 2020 @03:08AM
(#23016278)
Templates were an attempt to get macros into the language.
Re:Proving that C++'s grammar is undecidable
by camccar on Tuesday April 28, 2020 @11:13PM
(#23014895)
I like it. After working in golang for a while I miss more robust languages that can express themselves in complicated and creative ways. I hate makefiles though.
Re:Proving that C++'s grammar is undecidable
by dgellow on Wednesday April 29, 2020 @04:56AM
(#23016965)
I spent the past 3 years working professionally with Go, and while I enjoy it for $WORK it can also feel limiting in the way you expressed. I found out about D recently, and it seems to be a quite nice compromise between C++ and Go, giving you more way to express yourselves without having the pitfalls of C++.
Maybe something you would be interested into: http://dlang.org/.
Re:Proving that C++'s grammar is undecidable
by glouwbug on Wednesday April 29, 2020 @02:18AM
(#23016007)
New projects using C++20's module system will greatly ease the pain of makefiles.
Re:Proving that C++'s grammar is undecidable
by dgellow on Wednesday April 29, 2020 @04:44AM
(#23016884)
How do they ease the pain of makefile? When trying to understand what C++20 modules are trying to solve, that's really not that obvious to me that makefile will be simplified.
The syntax has become so ridiciously complicated, I have developed an involuntary gag relfex every time I read any kind of "modern" C++ code (i.e. heavy use of templates / generics / keywords).