Regarding the proposed Binray Literals Deprecation

Adam D Ruppe destructionator at gmail.com
Fri Sep 9 23:43:44 UTC 2022


On Friday, 9 September 2022 at 23:04:17 UTC, Walter Bright wrote:
> That's because it's poorly implemented and overly complex. The 
> implementation I showed in my presentation at Dconf is much 
> simpler.

The implementation is awful, but nobody cares enough to fix it 
since it just isn't that user friendly. It is often less hassle 
to translate it to binary or hex than to bother moving up, adding 
the import, then moving back.

However, the newer imported!"std.conv".octal!433 pattern 
alleviates that somewhat... though it is wordy enough that you 
then get tempted to make an alias which means moving up again.

> If you're using a lot of octal literals such that this is an 
> issue, one wonders, what for? The only use I know of is for 
> Unix file permissions.

I keep hitting them in random C code I'm translating. Various 
unix things beyond file permissions and a hardware manual for a 
think i had to drive (an rfid chip) used them for various bit 
triplets too.

I often prefer using binary literals anyway, but changing 
something like 0o50000 to binary is a little obnoxious.


More information about the Digitalmars-d mailing list