7 ms·
Scala turns 10
- VLM 13y agoMy "favorite" feature is the case class airity limit of 22. Is that ever a fun one to discover the hard way.
- gourlaysama 13y agoThis is finally going away in the next version (2.11, which will hit RC1 next month) see [1]. [1]: https://github.com/scala/scala/pull/2305 https://github.com/scala/scala/pull/2305
- VLM 13y agoThis will be an interesting side effect: "omit generation of unapply"
- gourlaysama 13y agoYes, this means there won't be a 1-to-1 conversion between a case class and a tuple anymore, since tuples are still limited to 22. This will probably break a few things out there (for people crazy enough to use case classes with 23+ parameters).
- thescrewdriver 13y agoI think the only place I've seen anyone wanting more than 22 parameters was people who had a database table with more than 22 rows (!) and where using the SLICK library.
- royjacobs 13y agoSo basically, anyone with a legacy database :)
- dk8996 13y agoYeah we ran into this problem... Scala and the whole ecosystem can get annoying. In the real world, outside of the academic bubble that Scala lives in, database tables are over 22 columns.
- bad_user 13y agoIn Scala I find it more natural to group multiple columns together / break the case-class representing the table into multiple case-classes. The problem is that Slick needs to serialize/deserialize those case-classes into tuples.
- frowaway001 13y agoI think the arity limit is more or less planned to be fixed in Scala > 2.11 anyway.
- thescrewdriver 13y agoSeems to be fixed in v2.0: http://slick.typesafe.com/news/2014/01/21/slick-2.0.0-released.html http://slick.typesafe.com/news/2014/01/21/slick-2.0.0-releas...
- VLM 13y agoYou can also run into it with forms in play, although for a variety of reasons you hit it at 18. The whole situation just drips with arrogance... "we have a magic number, and if you hit it, you suck"
- dk8996 13y agoI agree. I know people posted a comment saying its fixed in 2.11 but if Scala wants to be production ready language it shouldn't take 10 years to address this.
- frowaway001 13y ago> "we have a magic number, and if you hit it, you suck" You mean like Java does since ... forever?
- saryant 13y agoThe problem is the real world doesn't always leave you with a choice. If you need to interface with a database that's got a table with 43 columns, good luck using Slick. Need to serialize it to JSON? Play-Json isn't going to like that. I'm very much looking forward to fixing this ridiculous situation. Onboarding a new hire to Scala with this being the first thing they run in to isn't pretty.
- neverminder 13y agoIt's a problem that I contemplate every day. More often than not I have to resolve to using Map in which case I have to use external JSON library, because like you mentioned - Play JSON is not that friendly with anything else than case class.
- saryant 13y agoWe've resorted to an ugly nested case class structure. We like Play-Json overall, it works well even with large (>100mb) JSON objects, but we'd love to not deal with that. TBH, it's a bigger problem with Slick where you we can't just mess with the schema since other systems use the same DB.
- VLM 13y ago"We've resorted to an ugly nested case class structure." Yes the same here, and I haven't found an idea that's overall better, taking everything into account.
- kclay 13y agoHave to agree.. I ran into this when on the first time using Scala ,when I thought it would be fun to learn the language and a framework at the same time (Play). After initial crying for a bit I gave up trying to reason why this limit was put in place and just nested my data structure.
- lmm 13y agoWhat are the implications of not implementing FunctionN? Will the apply method still be there? Can I still pass the case class companion object to a higher order function? Will shapeless' Iso.hlist still work? (that's the big one really, as it allows dealing with case classes more-or-less generically)
- gourlaysama 13y agoYes the apply method is still there. But since it has more than 22 arguments, you cant't lift it into a function object anymore. This will break some tools, like Play's forms, that need you to pass to a couple of serialization/deserialization functions. Shapeless will probably be fine, or at least, since it is macro based, it will be able to go around the missing unapply and extract the fields directly, like pattern matching does. (I don't know shapeless enough to go into more details)
- caoilte 13y agoAaaaah, interesting. Spray uses Shapeless heavily, so this should make it a shoo-in for the Typesafe stack.
- deleted 13y ago[deleted]
- stusmall 13y agoWhat ended up happening to the .NET target?
- saryant 13y agoIt hasn't been maintained so it's getting axed in 2.11.
- octo_t 13y agothe CLRs type system is in the annoying place of being both too powerful and underpowered to support scala's type system. If it was weaker (á la JVM) it would be fine, if it was more powerful it could represent stuff at runtime. I'm trying to find a link to the paper which says there is not an efficient one-to-one mapping from Scala to CLR
- noblethrasher 13y agoHope you find the link; I'd like to read that paper.
- densh 13y agoI've seen a few people reporting running Scala on .NET successfully with the help of IKVM [1] [1] http://www.ikvm.net/ http://www.ikvm.net/
- stusmall 13y agoI've seen this project listed before but have never used it. Can anyone with a decent amount of experience with it speak to the quality of it?
- platz 13y agoI heard the internals of the Scala compiler are really ugly and there isn't a true spec for why it does some of the things it does. So it might be hard to just make it match what the existing compiler does, because it's defined by it's implementation and it's hard to understand?
- dkhenry 13y agoWow I wouldn't have guessed it was that old.
- thescrewdriver 13y agoIt only started getting a lot of visibility after Twitter announced they were using it about 5 years ago.
- cstuder 13y agoHehe, I remember taking a compiler class by Martin Odersky when I was studying at EPFL 8 or 9 years ago. We had to implement a compiler for a mini-Scala. After that class, I thought I would ever see it again.
- deleted 13y ago[deleted]
- octo_t 13y agoHowever certain parts of Scala are slightly older (16/07/2003)[1] [1] - https://github.com/scala/scala/blob/master/src/library/scala/Option.scala#L303 https://github.com/scala/scala/blob/master/src/library/scala...
- ucarion 13y agoIt appears they've changed the look of the scala-lang website to celebrate this: http://www.scala-lang.org/ http://www.scala-lang.org/ (This is what it looked like yesterday: https://web.archive.org/web/20140119030617/http://www.scala-lang.org/ https://web.archive.org/web/20140119030617/http://www.scala-... )
- saryant 13y agoThe current design is actually the old design whereas the archive.org link is the real current design. Either they're doing a throwback thing for the anniversary or that's a remarkably coincidental server issue.
- ExpiredLink 13y agoWhen I looked at Scala briefly in 2006 or so built-in support for XML processing was a big selling point. Another one was 'multiparadigm' - like C++. It was clear at that time that Scala would not become a mainstream language.
- etrain 13y agoI don't follow the connection between your comments. XML Support as selling Point + Multiparadigm == !mainstream? I agree that scala has its quirks (IMO, the type system is way too complicated), but to have dismissed it based on two apparently unrelated features 8 years ago seems a little strange.
- hansjorg 13y agoXML literals are on its way out from the default language by the way. There's an ongoing effort to make the language smaller, and from 2.11 one has to include a package to support it.