> Meh, an overrated minor point and it is not particularly elegant in either 
> Rust or Swift anyway.

My opinion differs. I came to Nim from OCaml and found OCaml's ADTs much more 
elegant than Nim's way. Efficient, expressive, _elegant_. That's what it says 
on the box!

Yes, I'm well aware that elegance, like beauty, is in the eye of the beholder. 
I've yet to meet a programmer who has used a language with real ADTs who hasn't 
found that more elegant.

> Sum types have inherent problems with serialization. Nim's way of doing it is 
> ok.

Protobufs at least, are implemented for Rust (serde too), and support 
unions/sum types. In what way are these deficient?

That "no known C# or Python shops ban exceptions" is a silly point. C#, Python 
and many other languages wouldn't even be considered at all in those exception 
eschewing C++ shops because of their heavy runtimes. 
[This](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p0709r4.pdf) is 
the longish document that gets into the problem, and I could have sworn that 
you yourself posted it once.

Anyways, I'm very glad you agreed that some changes to Nim to accommodate C++ 
are worthwhile. I'm not a fan of OO in general, or C++ in particular, but I can 
tell you that some amazingly knowledgeable C++ programmers (I am not even close 
to being in their league) now believe that C++ is beyond saving, and are 
looking for other ways forward. That way has to take into account the existing 
code.

> The standard library should embrace .push: raises: [] (that means, exceptions 
> need to be annotated explicitly) and then we have the best solution around. 
> IMHO.

People will say that was tried with Java, and considered a failure, and ask 
"how is it different this time around?".

@deech I suppose if there is an official pattern matching library that would be 
better but I still think building it into the core would be better. Nim has 
multiple pattern matching libraries, but I haven't seen a single macro library 
in Rust to express things the way Nim does, only some union stuff added to aid 
C binding.

@Sixte, @deech: Yes, I'd support C++ style vtables, introduce classes and 
multiple inheritance. @shirleyquirk was disgusted at my proposing that before, 
and **rightly so** IMO, but Nim might be the best way forward for C++. Java => 
Kotlin, JS => TypeScript, C++ => ???. Nim could be that ???. Also, CRTP is used 
in the wild, at real companies with lots of code.

@deech if there is a more minimal Nim extension that you think is sufficient, 
I'm all ears. BTW, I think you meant "gin up". There is a British expression 
"gen up" but it means something different. 

Reply via email to