Re:Swift – observations from Rust’s original designer
by 14113 on Tuesday June 03, 2014 @04:11AM
(#7838664)
This is what annoyed me most about the whole Swift presentation. Swift is not in any way shape or form innovative, in terms of language features or design. It is however, another language that aims to be as productive as possible, while still being safe, like Java, C#, Rust, Go etc.
It'd be far more interesting to compare it to them (especially where they have bindings for iOS e.g. Java, C#) in terms of productivity, code maintainability, readability etc, instead of in terms of language features.
Re:Swift – observations from Rust’s original designer
by dbaupp on Tuesday June 03, 2014 @08:30AM
(#7839691)
Haskell has it for its type classes in the form of existentials[1] too:
forall a. SomeClass a => a
in Haskell is quite similar to &SomeTrait
in Rust.
Re:Swift – observations from Rust’s original designer
by twic on Tuesday June 03, 2014 @01:11PM
(#7841432)
I pretty much only know Java and shell script. Could someone perhaps explain what this "double duty" is? A small example would be really helpful.
Re:Swift – observations from Rust’s original designer
by CmonDev on Wednesday June 04, 2014 @03:49AM
(#7844449)
// protocol = interface
interface ISample { void Process(); }
ISample sample = new ConcreteSample(); // Duty #1
class GenericSampleProcessor<T> : where T : ISample // Duty #2
{ public void Process(T sample) { sample.Process(); } }
Re:Swift – observations from Rust’s original designer
by twic on Wednesday June 04, 2014 @08:20AM
(#7845118)
Ah, i see, thanks.
It's the same in Java:
ISample sample = new ConcreteSample(); // Duty #1
class GenericSampleProcessor<T extends ISample> // Duty #2
Java got generics in 1.5, released September 2004, and bounded types like this were in that release. C# got generics in 2.0, released in November 2005, and i imagine it had them too. I assume Java lifted this idea from elsewhere. I am really quite surprised that Mr Hoare thinks this is a novel discovery in Rust.
PS: Apple says "Swift is an innovative new programming language"! Just like everything else they do lately!