3 ms·
> With the kitchen sink approach of design I’d not be surprised if these get into the language eventually. Based on the history of C++, they will, but with ext
by xigoi 1y ago
> With the kitchen sink approach of design I’d not be surprised if these get into the language eventually.
Based on the history of C++, they will, but with extremely bizarre syntax. Instead of a.foo(b), it will be something like a@<foo>::&{b}.
- im3w1l 1y agoIsn't structural pattern matching basically the same as creating an anonymous struct whose fields are references, with a default assignment operator? Syntax ideas should spring to mind.
- vjvjvjvjghv 1y ago“ a@<foo>::&{b}” This made me smile. So true
- pjmlp 1y agoSee new reflection syntax.
- jandrese 1y agoWith every new version C++ takes one step closer to Rust.
- xigoi 1y agoRust syntax is ugly because of C++. They didn’t want to “spend their innovation tokens”, which apparently means copying the worst existing design just because it’s popular.
- p0w3n3d 1y agoBut Java also did it with optimizing perform(a -> a.add(1)) with perform(VeryLongAndComplicatedAddingIntegerFacade::add)
- p0w3n3d 1y agoSo true. For me C++ syntax is unreadable, but the ideas behind it are familiar
- kelseyfrog 1y agoThe justification will, of course, be that the other options break digraph support on some ancient platform that has no public spec and will never sunset - likely one IBM AS/400 in a basement with a 45 year uptime. Out of "respect for existing deployments," the syntax must accommodate the relic even though no one has seen it outside of the folklore of one 1993 Usenet post. Every tool chain will begrudgingly implement it and then years later when someone proposes removing it the counter argument will be, "we can't remove it now someone is using it!" The someone, of course, is a hobbyist on the mailing list whose project depends critically in the feature.
- bongodongobob 1y agoWell, they're still in use. I've encountered 3 in the last 5 years of consulting. Just because your startup doesn't have one doesn't mean they don't exist in the manufacturing world. Are they ubiquitous? No. Are they rare? Depends on the industry.
- kelseyfrog 1y agoPerfect! The standards committee will be able to reference this reply the next time they justify eye-bleeding syntax instead of having to go mine Usenet. Thank you.
- chris_wot 1y agoAnd the standards committee will be correct.
- wat10000 1y agoWhen you say they're still in use, do you mean AS/400s or digraphs?
- bongodongobob 1y agoAS/400s