News for hackers. Stuff that matters.
Re:Cppfront, Herb Sutter's proposal for a new C++ syntax by dataflow on Saturday September 17, 2022 @12:49PM (#32878958)
That colon is going to be quite burdensome to type, due to the need to hold the Shift key on a line where you otherwise might not need to. It might sound silly but I do think little things like this can really hinder adoption without people necessarily realizing it.
Re:Cppfront, Herb Sutter's proposal for a new C++ syntax by kagakuninja on Saturday September 17, 2022 @04:43PM (#32881387)
No more burdensome than using capitol letters (camel case), underscore (snake case), curly braces or quote marks.

Been using Scala for 7 years, and it has never even occurred to me this was a "burden".

Re:Cppfront, Herb Sutter's proposal for a new C++ syntax by Merad on Saturday September 17, 2022 @05:49PM (#32881933)
Meaning no offense but if you aren't exaggerating you might want to invest some time in typing lessons. I'm not even remotely close to being an expert typist and I spend most of the day going back and forth between a C style language (C#) and modern style that uses the colon (Typescript). The difference needed to type a colon doesn't even register.
Re:Cppfront, Herb Sutter's proposal for a new C++ syntax by dataflow on Saturday September 17, 2022 @06:00PM (#32882027)
I write both C++ and Python all the time and I type enough underscores and caps all day just fine, thank you. The colon doesn't register for me when I'm writing those either. When it did register for me was precisely when I started designing my own language, attempted to design declarations with this exact syntax, played around with it, and realized this is a burden I'd never noticed before, and that this was one thing that made languages more pleasant to write in.

Think of it like font kerning. Some people notice it, some don't, but most people prefer good kerning even if they never think about it.

Re:Cppfront, Herb Sutter's proposal for a new C++ syntax by KerrAvon on Saturday September 17, 2022 @02:40PM (#32880094)
You must not have used Python or classes in C++, where the colon is ubiquitous?

Does `{` not require shift on your keyboard?

Re:Cppfront, Herb Sutter's proposal for a new C++ syntax by dataflow on Saturday September 17, 2022 @02:46PM (#32880163)
> You must not have used Python or classes in C++, where the colon is ubiquitous?

You misread my comment. I'm talking about cases where existing prevalent syntax for that construct does NOT already require holding Shift. Python is better in this respect since ":" requires fewer presses of Shift than "{" or "}". This is not the case when you go from "int x = 1;" to "x: int = 1;".

Moreover, the inconvenience of going from 1 Shift to 2 is not the same as the burden of going from 0 to 1. Especially because you can often combine the 2 into 1 without releasing the modifier key in between.

And furthermore, variable declarations are far more common than class or function declarations, so you can't weight them equally.

Re:Cppfront, Herb Sutter's proposal for a new C++ syntax by hiccuphippo on Saturday September 17, 2022 @05:26PM (#32881734)
You could just change your keymap if you really need to. I used to remap / in my Spanish keyboards because normally it is shift+7.
Re:Cppfront, Herb Sutter's proposal for a new C++ syntax by wyan on Saturday September 17, 2022 @03:32PM (#32880671)
In many non-US keyboard layouts typing the ";" requires holding shift as well, so not sure how bad this issue is in actuality.
Re:Cppfront, Herb Sutter's proposal for a new C++ syntax by Oreb on Sunday September 18, 2022 @04:55AM (#32885730)
Most non-US keyboards are terrible for programming in general. I only use my native Norwegian keyboard layout when I need to type a significant amount of text in Norwegian. Whenever I need to type some code, I switch back to US layout. I believe most other programmers do the same.
Re:Cppfront, Herb Sutter's proposal for a new C++ syntax by qsort on Sunday September 18, 2022 @11:25AM (#32888306)
Yes, programming with anything other than the US layout is simply unbearable. I simply switched to the US layout for everything. Although to be fair my native language is Italian, which doesn't need many special characters.

Most programmers I know use native+US layouts (like you), a minority always uses US (like me), almost nobody uses a native layout to code.

Re:Cppfront, Herb Sutter's proposal for a new C++ syntax by TheFlyingFish on Monday September 19, 2022 @11:36AM (#32899792)
I'm an English speaker, so I'm curious: Italian technically requires some accent marks, right? Do you have a quick way to do those from a US layout, or do you just ignore them in casual conversation the way people tend to ignore capitals and (some) punctuation?
Re:Cppfront, Herb Sutter's proposal for a new C++ syntax by qsort on Monday September 19, 2022 @02:13PM (#32901853)
Yeah, technically it requires diacritical marks, but unlike French they are only written explicitly when they fall on the final letter of a word. Italian only has seven vowels, so these are the only common ones: è é ì ó ò ù à.

What I would do is this:

- Replace them with a single quote -> E' instead of È or É and so on.

- Ignore all uncommon marks.

In most contexts, it is perfectly acceptable to do that. A native speaker would understand without giving it a second thought or considering it impolite. I write emails to my boss like that.

If I had to make something meant for the public (say a UI, or a document), then I'd switch to the Italian layout for that purpose only and then go back to the US one.

Re:Cppfront, Herb Sutter's proposal for a new C++ syntax by account42 on Tuesday September 20, 2022 @06:43AM (#32910020)
Not for Italian, but I use a US keyboard layout with the addition of German umlauts behind right alt + letters (as well as right alt + ' and right alt + ` being dead keys to put accents on letters for foreign words). I find this much better than the standard German layout which puts all of @{[]}\~ behind right alt - and most of them on the right side of the keyboard too so you have to akwardly hit the right alt + combo with a single hand.
Re:Cppfront, Herb Sutter's proposal for a new C++ syntax by coliveira on Saturday September 17, 2022 @02:35PM (#32880020)
Tell this to people using Python. Every function, if, and loop has a colon at the end.
Re:Cppfront, Herb Sutter's proposal for a new C++ syntax by dataflow on Saturday September 17, 2022 @02:47PM (#32880176)
You misread my comment. I'm not saying "colons are bad", I'm saying "excessive holding of keys is bad".

if (cond) { } requires 4 presses of Shift (or 2, if you combine them).

if cond: foo requires 1 press of Shift.

I'm not sure what part of my comment makes you believe that I think the latter comes out worse than the former. If anything, the fewer keypresses probably strongly helped Python's success without people necessarily realizing it. Moreover, this might very well be one thing hindering more widespread adoption of Python's type annotations.

You also need to consider how common each construct is. A class declaration requiring 20 excessive keystrokes is not necessarily worse than a variable declaration requiring 1 excessive keystroke.

Re:Cppfront, Herb Sutter's proposal for a new C++ syntax by dureuill on Sunday September 18, 2022 @06:51AM (#32886380)
The number of excessive keystrokes is largely irrelevant (as long as it isn't an order of magnitude too much), because typing the code on keyboard is generally far from the limiting factor for the speed of writing code.

Most of the time you spend thinking about what you should be typing.

So optimizing for the number of keystrokes is optimizing for the wrong metrics

Re:Cppfront, Herb Sutter's proposal for a new C++ syntax by the_af on Saturday September 17, 2022 @07:59PM (#32882899)
But Scala and lots of other programming languages use ":" with no hindrance to adoption.

Also consider this: lots of hugely frequent characters and symbols that don't require SHIFT in EN-US keyboards do in other keyboards layouts, for example Spanish. So this cannot be a consideration, at least not a major one.

Re:Cppfront, Herb Sutter's proposal for a new C++ syntax by dataflow on Sunday September 18, 2022 @02:18AM (#32884922)
> But Scala and lots of other programming languages use ":" with no hindrance to adoption.

It's kind of weird to see you assert that with no attempt to establish its truth when Scala is something like... the ~20th most popular language? Whereas Python, C, C++, Java, VB, C#, etc. are right at the top. So either this is one of the (obviously many) factors hindering wider adoption of Scala, in which case the relative popularity is entirely consistent with this, or it isn't a factor, in which case the it would make sense to present at least some evidence to the contrary given that your assertion goes against the popularity rankings.

> Also consider this: lots of hugely frequent characters and symbols that don't require SHIFT in EN-US keyboards do in other keyboards layouts, for example Spanish. So this cannot be a consideration, at least not a major one.

I'm pretty sure the popularity of {most software technologies} outside the US and inside the US are very far from being independent variables.

Re:Cppfront, Herb Sutter's proposal for a new C++ syntax by the_af on Sunday September 18, 2022 @11:14AM (#32888205)
> It's kind of weird to see you assert that with no attempt to establish its truth when Scala is something like... the ~20th most popular language? Whereas Python, C, C++, Java, VB, C#, etc. are right at the top

The barrier to adoption of Scala has to do its functional programming side, as well as its complex libraries and types.

Kotlin also uses ": type" syntax, by the way. As does Python!

> I'm pretty sure the popularity of {most software technologies} outside the US and inside the US are very far from being independent variables.

It's hard to understand your point. Are you arguing that programming languages are less popular outside the US? Or "most software technologies"?

So let's sum it up: SHIFT concerns are very minor in comparison to other programming language ergonomics (in which need I remind you, C++ never fared very well), and the ": type" syntax is very common and mainstream in programming languages, with no hindrance to adoption.

Re:Cppfront, Herb Sutter's proposal for a new C++ syntax by gumby on Saturday September 17, 2022 @03:26PM (#32880598)
No emacs user would even notice.
Re:Cppfront, Herb Sutter's proposal for a new C++ syntax by metadat on Saturday September 17, 2022 @04:14PM (#32881150)
Or Vim and Python users. They type ":" a lot.
Re:Cppfront, Herb Sutter's proposal for a new C++ syntax by xigoi on Sunday September 18, 2022 @01:55AM (#32884800)
I actually have <space> mapped to : in Vim precisely because it's easier to press.