3 ms·
The article begins with how ADTs existed in the 80s, before they were called like that, and the ADT Wikipedia article also mentions the language Hope as origin
by weinzierl 2y ago
The article begins with how ADTs existed in the 80s, before they were called like that, and the ADT Wikipedia article also mentions the language Hope as origin from the 80s.
Record and Variant types were definitely in Pascal and likely already in ALGOL in the 60s.
Why wouldn't these qualify as ADTs by another name equally?
- IshKebab 2y agoI'm not a type theorist and the article isn't super clear IMO, but it sounds like they definitely would. The "algebraic data type" name was obsolete pretty much immediately, in the same way that nobody talks about horseless carriages now. It exists just to confuse people and is probably best avoided.
- noelwelsh 2y agoI think it's still useful as many languages (still!) have no equivalent to the Or / sum type part of algebraic data types.
- fanf2 2y agoAlgol 60 did not have record or structure types. Record types did not really become a thing until the mid-1960s around the time of CPL (1963) - Algol W (1966)
- deleted 2y ago[deleted]
- trealira 2y agoALGOL 68 did have structs and unions, however, which might be what they meant by "ALGOL in the 60s." That doesn't contradict what you say, though, since 1968 is already in the late 1960s.
- noelwelsh 2y agoI didn't recall anything like ADTs in Pascal, but I last used it a very long time ago, so I dug into it. A "record with variant part"[1] seems to be equivalent in expressive power to ADTs. However Pascal lacks the other part of the equation, which is the guarantees when taking apart such a type that you will handle all cases, a.k.a exhaustivity checking. In general, I think too much material focuses on the data defining part of algebraic data types, and not the data using part, known as strucural recursion, which is arguably more useful. (You tend to use data more than you define it.) It's also interesting that more "modern" libraries have forgotten these lessons. E.g. Python and Go have nothing like algebraic data types. [1]: https://www.freepascal.org/docs-html/ref/refsu15.html https://www.freepascal.org/docs-html/ref/refsu15.html
- weinzierl 2y agoThere is also a stand alone sum type called Variant. https://www.freepascal.org/docs-html/ref/refse18.html#x45-650003.7 https://www.freepascal.org/docs-html/ref/refse18.html#x45-65...
- noelwelsh 2y agoI think that's more like an any type, as you can assign any value to it. A sum type can only take on values that are defined at the time the sum type is defined.
- 082349872349872 2y agoFor me, algebraic data types are not only about joining but also breaking apart (cleaving and cleaving, respectively), so the lack of pattern matching on constructors would be a negative, causing me to say: (especially as one of the sibling comments was making a big deal about rings) „No, Pascal, I think not”.