Standardize base types for metaprogramming

Monkyyy crazymonkyyy at gmail.com
Thu Apr 4 20:14:54 UTC 2024


On Wednesday, 3 April 2024 at 19:14:01 UTC, Dukc wrote:
> On Thursday, 29 February 2024 at 21:16:32 UTC, monkyyy wrote:
>> [...]
>
> I have some gripes with this list. For example, `""` is *not* a 
> good "zero" value. If we define one, it should be defined only 
> for types that have a literal zero value. That means ints and 
> floats and other numeric types, nothing else.
>
> I'm more sympathetic to the general notion though. We could 
> well have a property called somthing like `.validDefault` that 
> would be 0 for floats, `'\0'` or `' '` as opposed to `'\xff'` 
> for `char`s and so on. Maybe it should be undefined for classes 
> though. There's not really a good `.validDefault` value for 
> `object`, as a null reference is hardly any more valid than 
> NaNs are. Same for pointers.
>
> The thing with metaprogramming is, you really can't be fully 
> generic no matter the language rules. Even if you had a nice 
> valid value for every built-in type, people will want to define 
> types there can be no good values for. An extreme example is 
> the bottom type. It can only ever be:
> 1. A type system breaking unsafe value.
> 2. Never instantiated in actual execution flow.

I kinda want to drop all debates about details and just want more 
options then .init and the very questionable set of float and int 
not even matching.

If it would be just a bunch of polls and what string.zero 
outputted was different then what I expect, whatever


More information about the dip.ideas mailing list