[Dlang-internal] I need cent and ucent to be implemented soon

ryuukk_ ryuukk.dev at gmail.com
Sat Dec 25 16:03:14 UTC 2021


On Saturday, 25 December 2021 at 04:17:11 UTC, Walter Bright 
wrote:
> On 12/24/2021 4:35 PM, ryuukk_ wrote:
>> I didn't know what ``cent`` was, then someone in the IRC 
>> mentioned ``big int``
>
> `cent` is a 128 bit int. Cent for "100".
>
>> I think that is one of the baggage from C that it not worth 
>> keeping for the long term
>
> It doesn't come from C.

And it seems they are even parting away from it, C23 proposals 
has u8 _Decimal32/64/128!


>> If were to add a new type, why not start fresh and put some 
>> consistency, i propose doing what C++/Rust/Swift/Zig and other 
>> language did, prefix with integer/unsigned following by the 
>> size
>
> The size postfix is fine for the first week learning the 
> language, then it becomes annoying:
>
> 1. visual noise
> 2. takes many words to speak it
> 3. touch-typing doesn't work well with it
> 4. takes longer to type it

1. i strongly disagree, it is easier to write, easier to modify, 
and doesn't involve mental gymnastic to remember the size
2. i don't think that's a valid argument
3. it does, i32 / s32, you know what to change if you want 
unsigned/signed, or increase the size!, something you can't with 
short / int / long, you have to scrap the entire thing
4. i disagree s32 is even with int, u32 has 1 less character than 
uint, u64 has 2 less characters than ulong, so no, it doesn't 
takes longer to type!




More information about the Dlang-internal mailing list