Porting std.typecons to Phobos 3

ryuukk_ ryuukk.dev at gmail.com
Sat Nov 9 05:44:37 UTC 2024


- https://github.com/WalterBright/documents/blob/master/sumtype.md

- 
https://github.com/tgehr/DIPs/blob/tuple-syntax/DIPs/DIP1xxx-tg.md

I couldn't find the proposed DIP for nullable, so let's see what 
other language did:

- Rust: https://doc.rust-lang.org/rust-by-example/std/option.html
     - not builtin, but they have pattern matching, so it's as bad 
to use
- Zig: built in and very nice to use: 
https://ziglang.org/documentation/master/#Optionals

- C3: same, built in, very nice to use: 
https://c3-lang.org/language-common/optionals-essential/

- Swift: builtin(hack), very nice to use: 
https://developer.apple.com/documentation/swift/optional

- odin: builtin, in the sense you have nothing to import, 
https://odin-lang.org/docs/overview/#maybet


I could go on and mention the other popular high level language, 
C#, Java, Kotlin, they all agreed to promote them as essential 
language feature

The question to be asked is, there is demand for better Tuple, 
Sumtype and Optionals, why not take the opportunity to give 
better, ie: not requiring importing bunch of templates

We want great build time and great error messages


"The US government wants developers to stop using C and C++"

https://www.theregister.com/2024/11/08/the_us_government_wants_developers/

Only the compiler can help, the difference between a library and 
a core concept of a language, the plan is to make D attractive to 
that crowd, and not make them discover better C/C++ in Rust or 
others



More information about the Digitalmars-d mailing list