Time to move std.experimental.checkedint to std.checkedint ?

Rumbu rumbu at rumbu.ro
Tue Mar 30 16:56:55 UTC 2021


On Tuesday, 30 March 2021 at 15:28:04 UTC, Jacob Carlborg wrote:
> On Tuesday, 30 March 2021 at 03:31:05 UTC, Walter Bright wrote:
>
>> Note that Zig has a very different idea of integers than D 
>> does. It has arbitrary bit width integers, up to 65535. This 
>> seems odd, as what are you going to do with a 6 bit integer? 
>> There aren't machine instructions to support it. It'd be 
>> better off with a ranged integer, say:
>>
>>    i : int 0..64
>
> The question is then, does that mean that Zig has over 131070 
> keywords (65535  for signed and unsigned each)? :D. Or does it 
> reserve anything that starts with i/u followed by numbers? Kind 
> of like how D reveres identifiers starting with two underscores.
>
> --
> /Jacob Carlborg

In Zig, integer type names are not considered keywords, e.g you 
can use i7 as a variable name or i666 as a function name.

But you cannot define new types with this pattern, you get an 
error message stating that "Type 'i?' is shadowing primitive type 
'i?'".

So it's more like a contextual keyword in C#.


More information about the Digitalmars-d mailing list