Live data from Hacker News

Swift is a lot like Scala

leverich.github.io

41–50 of 54 posts

Re: Swift is a lot like Scala

#41
post #28
post #25

Earlier quoted context omitted.

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.

Scala can't be easily beaten there? Man...have you used C#?

I mean, I use Scala every day, but C# gives you so much solely on reification and Scala manifests are a real poor patch.

Re: Swift is a lot like Scala

#42
post #34

Earlier quoted context omitted.

Swift enums and Scala case classes both attempt to emulate ML/Haskell Algebraic Data Types. In the design goal there they both are identical. Swift's enums are a more faithful translation than Scala's case classes (since case classes are more ambitiously/granularly typed, and this leads to some weakness [0]). Right now they're a little broken, though, since recursive enums lead to compiler bugs (here's are a few of m…

Not sure what weakness you're referring to in that SO post; the OP is actually saying otherwise: > I have always considered the Scala variation to be on the advantageous side [relative to Haskell]. Daniel Spiewak does provide an answer that points out a weakness with scala collections when used with ADTs, but (G)ADTs of and in themselves are pretty damn elegant in Scala, arguably rivaling Haskell equivalent (provided…

Daniel's answer is not specific to Scala's collections library but instead any generic type unless it's set to be invariant. That ultimately leads to a tradeoff between soundness and convenience (as mentioned in comment toward Scalaz's Monad impl).

Ultimately, both of his points come from the idea that you genuinely want a mechanism for deferring information to runtime and case classes almost give that to you if it weren't for their default to greater typing granularity and covering it up with subtyping relations.

The point I made in the comments is that this throws away syntax directness almost everywhere and that tosses out a lot of inference.

Ultimately, Haskell's GADTs give you the same power as Scala's case classes, but they require you to actually ask for that level of type specificity and then provide an explicit and delimited family so that inference doesn't get as mucked up.

So, I think Scala is certainly workable... but in general disallows precision of desired expression, ironically, by defaulting to greater precision of actual "type".

(There's finally a totally pedantic argument to be had that "Inl and Inr aren't types" in some foundational sense. Of course you can consider them types and model a perfectly reasonable type system off of that consideration. That said, they're something a little different from your standard MLTT/BiCCC/TypeTheory/Logic types, fwtw)

Re: Swift is a lot like Scala

#43
post #23

I know it's off-topic but I every time I heard 'Swift' I feel sorry for 'the other Swift' i.e. http://en.wikipedia.org/wiki/Swift_(parallel_scripting_langu...

Apple put this phrase on their Swift page https://developer.apple.com/swift/ "Looking for the Swift parallel scripting language? Please visit http://swift-lang.org"

Re: Swift is a lot like Scala

#44
post #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? 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…

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

No. The whole reason to have types is for safety, type safety. Where more errors/bugs can be found and found a whole lot earlier. That's the basis of the argument of dynamic vs statically-typed languages. If performance was all that matters, we'd all be writing C and C++.

Re: Swift is a lot like Scala

#45

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 o…

The Scala experiment, as you say, seems to be kicking some serious tail, no need to speak of it in the past tense ;-)

Big companies are adopting Scala (Twitter, LinkedIn, eBay, Yahoo, Sony, and so on), not surprising given Spark, Spire, Akka, Play, etc. The Scala language itself is certainly not without problems; at this point the ecosystem behind it is arguably its greatest strength.

Rest assured, if there is a language that will supplant Java on the JVM (highly unlikely in the near-term), it will be Scala (or some variant [Dotty] thereof). Ceylon's got a shot but they're a bit late to the party, and Kotlin isn't even 1.0 yet (Java 8 and 9 will punish that project's adoption, IMO).

Re: Swift is a lot like Scala

#46

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 o…

The Scala experiment, as you say, seems to be kicking some serious tail, no need to speak of it in the past tense ;-) Big companies are adopting Scala (Twitter, LinkedIn, eBay, Yahoo, Sony, and so on), not surprising given Spark, Spire, Akka, Play, etc. The Scala language itself is certainly not without problems; at this point the ecosystem behind it is arguably its greatest strength. Rest assured, if there is a lang…

> Rest assured, if there is a language that will supplant Java on the JVM (highly unlikely in the near-term), it will be Scala

Not sure why you're so confident since Scala has gained about 2% mind share in ten years of existence and it's still all but impossible to find Scala jobs, but hey, if you like it, good for you.

Re: Swift is a lot like Scala

#48
post #41
post #28

Earlier quoted context omitted.

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.

Scala can't be easily beaten there? Man...have you used C#? I mean, I use Scala every day, but C# gives you so much solely on reification and Scala manifests are a real poor patch.

Holy shit you have got to be joking. Really trolling now, are we? Take a look at things like Shapeless (https://github.com/milessabin/shapeless).

Re: Swift is a lot like Scala

#49
post #42

Earlier quoted context omitted.

Not sure what weakness you're referring to in that SO post; the OP is actually saying otherwise: > I have always considered the Scala variation to be on the advantageous side [relative to Haskell]. Daniel Spiewak does provide an answer that points out a weakness with scala collections when used with ADTs, but (G)ADTs of and in themselves are pretty damn elegant in Scala, arguably rivaling Haskell equivalent (provided…

Daniel's answer is not specific to Scala's collections library but instead any generic type unless it's set to be invariant. That ultimately leads to a tradeoff between soundness and convenience (as mentioned in comment toward Scalaz's Monad impl). Ultimately, both of his points come from the idea that you genuinely want a mechanism for deferring information to runtime and case classes almost give that to you if it w…

Thanks, Scala collections in particular are unfortunately capable of wreaking havoc (Paul Phillips' infamous List(1,2,3).contains("your mom")) in surprising ways.

I'm not saying that Scala's approach to G(ADT)s is flawless (by any means), but it is powerful, and to cast a strength as a weakness is a bit disengenious, particularly when the SO user is in fact saying, what's the deal, Scala is superior to Haskell in this area.

Then again, Scala's terribly unpopular in the Haskell community and here on HN, so casting the language in a bad light is of no surprise.

FWIW, I really enjoyed that Twitter Bird pic tweeting out Haskell's logo in this language usage breakdown[1]. Heh, the language that everybody is talking about...and nobody is using O_o

Saying that, Haskell by all indications seems poised to take off, so I may be eating my words in future. We shall see, next 3 to 5 years on and off the JVM are going to be interesting times indeed ;-)

https://github.com/Dobiasd/programming-language-subreddits-a...

Re: Swift is a lot like Scala

#50

Earlier quoted context omitted.

The Scala experiment, as you say, seems to be kicking some serious tail, no need to speak of it in the past tense ;-) Big companies are adopting Scala (Twitter, LinkedIn, eBay, Yahoo, Sony, and so on), not surprising given Spark, Spire, Akka, Play, etc. The Scala language itself is certainly not without problems; at this point the ecosystem behind it is arguably its greatest strength. Rest assured, if there is a lang…

> Rest assured, if there is a language that will supplant Java on the JVM (highly unlikely in the near-term), it will be Scala Not sure why you're so confident since Scala has gained about 2% mind share in ten years of existence and it's still all but impossible to find Scala jobs, but hey, if you like it, good for you.

Wow, you are really getting desperate. Don't have anything better to do than trying to troll about a topic you barely understand?
Post reply on HN