News for hackers. Stuff that matters.
Re:Microfeatures I'd like to see in more languages by masklinn on Thursday January 05, 2023 @05:12PM (#34267591)
> I don’t know if they also allow it for hex numbers.

They do e.g. Python

    >>> 0x_ab_cd_01_23
    2882339107
or

    >>> 0b_0010_0100
    36
Re:Microfeatures I'd like to see in more languages by rwmj on Thursday January 05, 2023 @05:17PM (#34267665)
Even C these days, although they chose ' instead of _ :-(
Re:Microfeatures I'd like to see in more languages by kwhitefoot on Friday January 06, 2023 @03:58AM (#34272547)
My guess is that they did that because there are real human languages where ' is used as a thousands separator.
Re:Microfeatures I'd like to see in more languages by xigoi on Friday January 06, 2023 @05:16AM (#34273035)
There are also real human languages where a space is used as a thousands separator, and an underscore is kind of the programming equivalent of a space.
Re:Microfeatures I'd like to see in more languages by kwhitefoot on Friday January 06, 2023 @06:03AM (#34273379)
A half space is British Standard for thousands separator if memory serves, also standard in Norway.
Re:Microfeatures I'd like to see in more languages by rwmj on Friday January 06, 2023 @09:18AM (#34274786)
The reason they used quote is outlined in the proposal: https://open-std.org/JTC1/SC22/WG14/www/docs/n2626.pdf

TL;DR is that it's because C++ uses quote. The reason C++ uses quote (they considered underscore) is because of a very obscure feature of C++ called custom literal suffixes which I'd never even heard of, but numbers can be suffixed with a custom identifier, and since single underscore is a valid identifier you can't use that. (https://en.cppreference.com/w/cpp/language/user_literal)

Re:Microfeatures I'd like to see in more languages by andix on Friday January 06, 2023 @03:02PM (#34280183)
Swiss German for example. But space, half space and dot is also common in Europe. Just not a comma, because this is used as a decimal separator (fractions) in most countries.