Live data from Hacker News

Swift is a lot like Scala

leverich.github.io

21–30 of 54 posts

Re: Swift is a lot like Scala

#21
post #12

Kinda frustrating that the language comparaison is by syntax instead of features ( http://www.scribd.com/doc/227879724/Swift-vs-Scala-2-11 is what's referenced in the article). I'm fairly convinced that Swift enums and Scala case classes are only superficially the same, and based off the discussions I've heard about generics in Swift, Swift is miles aways from even C++-levels of generics, let alone Scala's. Unless so…

I agree - the examples given are almost infuriating. Whilst I can't comment on how idiomatic the Swift code is, the Scala code is anything but. There's little benefit to using a language like Scala if you're going to count the number of apples and oranges in a list by incrementing a mutable var for each type.

Re: Swift is a lot like Scala

#22
post #9

It's interesting, given that Joel Spolsky says of Swift "It feels exactly like go", and this person is saying, "Swift is a dialect of Scala". Does that then imply that Go is a dialect of Scala?

Sadly Go chose to use Garbage Collection instead of Reference Counting. I love using Python or Swift for applications that allocate (and free) real hardware resources, like OpenGL texture maps, frame buffer objects and in memory images.

Because they care about performance in multi-core contexts.

Re: Swift is a lot like Scala

#24

Earlier quoted context omitted.

And they all feel like dialects of OCaml ;). (I am not saying 'Haskell' here, because it does not include object oriented programming.) The thing is that the current generation of languages have so many overlapping features, that they are not all that different language-wise. Just like moving between Pascal, Ada, and Modula-2 was not that hard. Also, I'd say that Go is the exception here, because in contrast to Go, S…

Aw, but what about utterly fast to develop in, utterly awesome at concurrency, utterly easy for ruby/python/dynamic-language devs to pick up and gain huge performance boosts, utterly easy to get in to the ecosystem, and utterly simple to use? I'm not a language geek mind you, but if people find it useful (and plenty of large and small companies have had huge wins with it at rapid pace) who cares if it's utterly borin…

Aw, but what about utterly fast to develop in, utterly awesome at concurrency, utterly easy for ruby/python/dynamic-language devs to pick up and gain huge performance boosts, utterly easy to get in to the ecosystem, and utterly simple to use?

Most of those characteristics are also true for PHP, which is arguably also easier to deploy, since nearly every virtual hosting provider has mod_php enabled and it is 'platform-independent'.

Sure, it gets the job done.

However, a lot of PL research has gone into making languages safer. Allowing you to make bugs that manifest at runtime, compile time errors. And while large bugs may not be that big a deal for the average web application, not everyone writes web applications. Billions are wasted on software bugs, from research that turns out to be invalid due to multiplication of units of measurement that cannot be multiplied, to Bitcoins that are lost due to programming errors, to deaths caused by errors in life-critical software.

Go does almost nothing to solve the one of the largest challenges of software, namely to make it safer. Sure, it's more safe than C. But arguable it's even a step back from Java by its refusal to include some form of parametric polymorphism, requiring developers to revert to runtime introspection instead.

Re: Swift is a lot like Scala

#25
post #12

Kinda frustrating that the language comparaison is by syntax instead of features ( http://www.scribd.com/doc/227879724/Swift-vs-Scala-2-11 is what's referenced in the article). I'm fairly convinced that Swift enums and Scala case classes are only superficially the same, and based off the discussions I've heard about generics in Swift, Swift is miles aways from even C++-levels of generics, let alone Scala's. Unless so…

Author of those slides here.

They were made on the next day after the language was presented on WWDC and were based purely on the first draft of the Swift book published online by Apple. Needless to say the book was more of a tutorial than a full-blown spec at that time and many important aspects were not covered (generics were lightly documented without much details).

Can you please provide details about generics in Swift and how exactly are they different from Scala's?

Edit: changed 'superior' to 'different'.

Re: Swift is a lot like Scala

#26
post #22
post #9

Earlier quoted context omitted.

Sadly Go chose to use Garbage Collection instead of Reference Counting. I love using Python or Swift for applications that allocate (and free) real hardware resources, like OpenGL texture maps, frame buffer objects and in memory images.

Because they care about performance in multi-core contexts.

Reference counting and multi-core performance are not mutually exclusive at all. In a lot of applications where you exploit parallelism, you parallelise loops (e.g. via OpenMP), usually objects go out of scope outside the parallelized loop (single threaded code), so you can use a bare pointer. In the loop you do mostly stack allocations.

Of course, there are degenerate cases where there's a lot of lock contention on the reference count. However, there are degenerate cases in most garbage collectors for multi-core as well. Isn't Go still using a stop-the-world GC?

Edit: I wanted to add that I am not against garbage collectors. You lose deterministic destructors, but a well-developed garbage collector like the JVM's is very performant in most situations, and in many cases indeed more performant than reference counting.

Re: Swift is a lot like Scala

#27
There are similarities, of course, as you could expect from any modern language (i.e. created in the 21st century) but if there is something noteworthy about all the recent languages that came out these past years (Kotlin, Ceylon, Swift, Fantom, Gosu), it's not how much they look like Scala but all the features from Scala that they left out.

The Scala experiment produced a lot of interesting results and added a lot of clarity about what features are interesting in a modern language (property, lambda, extension methods, sum/union types, and a few others) but the complexity of Scala's type system and the uncertain shape of its code base (see Paul Phillips' talks) is demonstrating that it's often wise to support fewer features rather than be a kitchen-and-sink language.

I am very excited by this trend of minimalism in languages and the willingness from language designers to say "Interesting feature but it will add too much complexity, so I'm not adding it".

Best of luck to Swift, and I can't wait to see if a language will finally emerge on the JVM to supplant Java (even though this might take a solid decade).

Re: Swift is a lot like Scala

#28
post #25
post #12

Kinda frustrating that the language comparaison is by syntax instead of features ( http://www.scribd.com/doc/227879724/Swift-vs-Scala-2-11 is what's referenced in the article). I'm fairly convinced that Swift enums and Scala case classes are only superficially the same, and based off the discussions I've heard about generics in Swift, Swift is miles aways from even C++-levels of generics, let alone Scala's. Unless so…

Author of those slides here. They were made on the next day after the language was presented on WWDC and were based purely on the first draft of the Swift book published online by Apple. Needless to say the book was more of a tutorial than a full-blown spec at that time and many important aspects were not covered (generics were lightly documented without much details). Can you please provide details about generics in…

Don't bother, people will just say X is better than Scala here. They don't know the amount of research done by Odersky on generics and why Scala can not be easily beaten in this area at least.

Re: Swift is a lot like Scala

#29
post #25
post #12

Kinda frustrating that the language comparaison is by syntax instead of features ( http://www.scribd.com/doc/227879724/Swift-vs-Scala-2-11 is what's referenced in the article). I'm fairly convinced that Swift enums and Scala case classes are only superficially the same, and based off the discussions I've heard about generics in Swift, Swift is miles aways from even C++-levels of generics, let alone Scala's. Unless so…

Author of those slides here. They were made on the next day after the language was presented on WWDC and were based purely on the first draft of the Swift book published online by Apple. Needless to say the book was more of a tutorial than a full-blown spec at that time and many important aspects were not covered (generics were lightly documented without much details). Can you please provide details about generics in…

I think you meant 'inferior'.

Re: Swift is a lot like Scala

#30

Earlier quoted context omitted.

Aw, but what about utterly fast to develop in, utterly awesome at concurrency, utterly easy for ruby/python/dynamic-language devs to pick up and gain huge performance boosts, utterly easy to get in to the ecosystem, and utterly simple to use? I'm not a language geek mind you, but if people find it useful (and plenty of large and small companies have had huge wins with it at rapid pace) who cares if it's utterly borin…

Aw, but what about utterly fast to develop in, utterly awesome at concurrency, utterly easy for ruby/python/dynamic-language devs to pick up and gain huge performance boosts, utterly easy to get in to the ecosystem, and utterly simple to use? Most of those characteristics are also true for PHP, which is arguably also easier to deploy, since nearly every virtual hosting provider has mod_php enabled and it is 'platform…

Speaking descriptively, not normatively, it just seems the industry is moving towards easier, not safer. yes, including PHP, but also python and ruby.

I think the trade-off is that safer requires more upfront design, and is more viscous (harder to change). Whereas industry seems to get better end-results, with less design and faster iteration (i.e. so-called extreme programming). What's the point goes the argument of getting the wrong thing perfectly correct?. Added to this is the relative unpopularity of safer languages like SML etc.

Statically typed languages (Java etc) are mainly popular more because of performance, not safety.

So... I predict easier will continue to beat safer... in terms of popularity.

Post reply on HN