News for hackers. Stuff that matters.
Re:Swift architecture at Uber by slavapestov on Thursday April 27, 2017 @12:04AM (#14209093)
Ada does not have parametric polymorphism, algebraic data types, Objective-C interoperability, etc.
Re:Swift architecture at Uber by shakna on Thursday April 27, 2017 @01:47AM (#14209447)
I wasn't criticising Swift. I criticised certain features of Swift being regarded as modern.

But, if you insist:

> Ada does not have parametric polymorphism.

Yes, it does. [1][2] It's supported through the use of generic units.

> Ada does not have ... algebraic data types

Ada does have tagged records, and other variant types, and has had for quite some time. [0] They aren't quite Sum Types, but are incredibly close.

> Ada does not have... Objective-C interoperability

GNAT does. It's part of the GNU Compiler Collection, and as such, can be linked against other languages supported by the toolchain. GCC also supports Objective-C.

[0] http://archive.adaic.com/standards/83rat/html/ratl-04-07.htm...

[1] https://rosettacode.org/wiki/Parametric_polymorphism#Ada

[2] https://en.wikibooks.org/wiki/Ada_Programming/Generics#Param...

Re:Swift architecture at Uber by mpweiher on Thursday April 27, 2017 @11:02AM (#14212013)
> GNAT does. It's part of the GNU Compiler Collection

Yay! :-)

One thing that's probably almost unknown these days is that Objective-<X> was always supposed to be something you can easily add to any <X>, and in fact there were quite a few of these, including Objective-Assembler.

Re:Swift architecture at Uber by slavapestov on Thursday April 27, 2017 @05:48PM (#14215031)
Turns out I was quite ignorant of Ada - thanks for the pointers.
Re:Swift architecture at Uber by pjmlp on Thursday April 27, 2017 @01:10AM (#14209323)
Ada surely has generics since 1983.

Ada 2012 probably even has more generic data containers on their standard library than Swift.

ADTs can be done via tagged records.

Re:Swift architecture at Uber by slavapestov on Thursday April 27, 2017 @01:25AM (#14209362)
> Ada surely has generics since 1983.

That's interesting, I did not know that.

From a quick glance it appears they do not have bounded polymorphism ("protocol-constrained generic parameters"), associated types, or existential types ("values of protocol type"). So for example if you have a generic Set data type you would have to pass in an equality and hash function to each operation instead of saying that the element type is Hashable, etc.

The explicit instantiation looks quaint, but it reminds me of ML functors for some reason:

    procedure Instance_Swap is new Swap (Float);
Re:Swift architecture at Uber by pjmlp on Thursday April 27, 2017 @02:21AM (#14209580)
> From a quick glance it appears they do not have bounded polymorphism

You can use abstract classes and interfaces for that.

Re:Swift architecture at Uber by jacquesm on Thursday April 27, 2017 @12:12AM (#14209121)
Do those first two strike you as extremely limiting if they are not present in a programming language?
Re:Swift architecture at Uber by slavapestov on Thursday April 27, 2017 @12:19AM (#14209140)
Yes. Having done a fair bit of C programming in the kernel, where generic data structures are simulated with preprocessor macros and unsafe casts, I much prefer either static languages with generics, or dynamically typed languages.
Re:Swift architecture at Uber by shakna on Thursday April 27, 2017 @01:52AM (#14209460)
Ada was designed for the DOD by the High Order Language Working Group for this.

They wanted something safe for embedded, and the original specification in '83 included generics, so you could handle data structures in a nice, safe, performant manner.

Re:Swift architecture at Uber by jacquesm on Thursday April 27, 2017 @12:22AM (#14209149)
That's a fair point. Personally I don't like that style either so I avoid it at all costs but I've seen it practiced. It usually revolves around creative use of 'void' pointers and terribly hard to isolate bugs.