Guido van Rossum wrote:
On Mon, May 16, 2016 at 7:45 AM, Koos Zevenhoven <firstname.lastname@example.org mailto:email@example.com> wrote:
On Mon, May 16, 2016 at 4:57 AM, Guido van Rossum <firstname.lastname@example.org <mailto:email@example.com>> wrote: [...]
unions in Python are always tagged (since you can always
introspect the object type).
The "Sum" types talked about in the referenced article are what Haskell calls "algebraic types". They're not really the same as the Union[X,Y] types we're talking about here, because a Union type simply tells the type checker that one of a number of different types could be present at run time. The code might introspect on the type, but it doesn't have to do anything special to access one of the branches of the union -- it just goes ahead and uses the value.
An algebraic type, on the other hand, is a new type of run-time object that has to be explicitly unpacked to access its contents. It's more like a class in that respect.