Re:Cppfront, Herb Sutter's proposal for a new C++ syntax
by Jtsummers on Saturday September 17, 2022 @02:55PM
(#32880267)
:_ appears to mark it as a generic type parameter, the `hello` function in the example ought to be equivalent to this straight C++:
I kind of like this, actually, because so many people I've worked with are afraid of templates in C++, but they seem to have no trouble with essentially equivalent code using generics (in other statically typed languages) or dynamically typed languages where it "just works" (until it doesn't). Not that we'll be adopting this any time soon, but I suspect they'd be more amenable to this form when `template` seems to make them quake in their boots.
[ Parent
| on HN ]
Re:Cppfront, Herb Sutter's proposal for a new C++ syntax
by gpderetta on Saturday September 17, 2022 @05:39PM
(#32881854)
The syntax:
void hello(auto msg){
...
}
Is legal today (since C++20 IIRC) and it is equivalent to your first example.
Re:Cppfront, Herb Sutter's proposal for a new C++ syntax
by philippejara on Saturday September 17, 2022 @03:46PM
(#32880831)
Ah actually missed that, good catch, it does seem to be a step forward in regards to dealing with the syntactical clunkyness of templates. Now if we could have keyword arguments in functions calls without having to deal with some kludge...