[OT] Error handling in C3 language

user1234 user1234 at 12.de
Wed Nov 19 12:58:43 UTC 2025


On Thursday, 29 May 2025 at 20:18:27 UTC, Kagamin wrote:
> https://c3-lang.org/language-common/optionals-advanced/
> The language is quite nice, resembles BetterC, but also the 
> first ergonomic language where I see the `Result` type in 
> action. `Result` is also used for nullable types.
> ```
> // Function returning an Optional
> fn int? maybe_func() { /* ... */ }
>
> fn void? test()
> {
> 	// ❌ This will be a compile error
> 	// maybe_function() returns an Optional
> 	// and 'bar' is not declared Optional:
> 	// int bar = maybe_function();
>
> 	int bar = maybe_function()!;
> 	// ✅ The above is equivalent to:
> 	// int? temp = maybe_function();
> 	// if (catch excuse = temp) return excuse?;
>
> 	// Now temp is unwrapped to a non-Optional
> 	int bar = temp; // ✅ This is OK
> }
> ```
> But striving to be evolution of C, faults look like error code 
> singletons and apparently don't carry much information.

Slightly related, if I've followed correctly the yesterday 
cloudflare outage was cause because a Result value was unwrapped 
without actually checking if it's valid.

https://www.reddit.com/r/rust/comments/1p0susm/cloudflare_outage_on_november_18_2025_caused_by/


More information about the Digitalmars-d mailing list