Live data from Hacker News

Scala: The Static Language that Feels Dynamic (Bruce Eckel)

artima.com

21–30 of 65 posts

Re: Scala: The Static Language that Feels Dynamic (Bruce Eckel)

#21
post #20

Earlier quoted context omitted.

Scala looks complex on paper, but my experience has been that in practice it's not that bad. If you're designing a library you need to think hard about types but you can put together an app very quickly in Scala and with a lot fewer initial bugs than in a dynamically typed language.

I wonder if there is value in making it easy to make library? I feel like the ruby eco system gains a lot for the rate at which people can try out ideas for libraries.

Scala forces you to consider your library interface more carefully. This makes it more work to build a library but I think it pays off in a cleaner, more consistent and self-documenting library. Scala makes you think a little harder in general but, in my experience, you also write better code.

All that painful refactoring and modularization that went into Rails 3 would have been a lot easier and, I suspect, less necessary if Rails had been written in Scala.

Re: Scala: The Static Language that Feels Dynamic (Bruce Eckel)

#22
post #10

Earlier quoted context omitted.

The Scala team have plans afoot to target LLVM and .NET too.

Do they have actual plans though? There has been talk of .NET support since the beginning. Basically I wouldn't hold my breath.

Unless they get significant outside help I'm very skeptical that we'll see a usable Scala on LLVM or .NET any time soon. The core Scala team is very talented but they seem to have their hands full with the JVM version.

Re: Scala: The Static Language that Feels Dynamic (Bruce Eckel)

#24

Earlier quoted context omitted.

Do they have actual plans though? There has been talk of .NET support since the beginning. Basically I wouldn't hold my breath.

Scala already compiles to the CLR, but support for it is nowhere near that for the JVM.

Last time I looked (early 2009), Scala compilation to the CLR was a bit of a joke. It targeted version 1.1 of the CLR, which had been superseded nearly 4 years earlier. I think the problem was with the predefined libraries. Supposedly you could get it to work with v2 but I never did.

They also did themselves no favours by having the Scala compiler dump out MSIL assembler code rather than a .NET assembly. You had to separately run the ilasm tool to get an executable. Obviously for a production environment you'd package this up in a build file, but for experimenting with the language it was a bit of a speed bump.

This is without even looking at the language features and libraries that were supported on the JVM but not on the CLR (e.g. structural types, parser combinators).

My experience may be out of date here, but the scala-lang page on .NET support is still datestamped July 2008, so I'm not too optimistic. A great pity, as Scala always seemed a great fit for the CLR and would provide some nice competition to C# and F#.

Re: Scala: The Static Language that Feels Dynamic (Bruce Eckel)

#25
post #20

Earlier quoted context omitted.

I wonder if there is value in making it easy to make library? I feel like the ruby eco system gains a lot for the rate at which people can try out ideas for libraries.

Scala forces you to consider your library interface more carefully. This makes it more work to build a library but I think it pays off in a cleaner, more consistent and self-documenting library. Scala makes you think a little harder in general but, in my experience, you also write better code. All that painful refactoring and modularization that went into Rails 3 would have been a lot easier and, I suspect, less nece…

I think of it more in terms of natural selection. If, and this is a big if, diversity is greater in language x than in language y due to ease of trying ideas, then there is more opportunity to hit on good ideas.

Re: Scala: The Static Language that Feels Dynamic (Bruce Eckel)

#26
post #2

The biggest thing that is still in the language that they should have removed early on is the native XML syntax support. If I were them I would take it out in 3.0 and break from that bad decision.

See my answer on Quora to "Will Scala ever remove XML literals?" http://www.quora.com/Will-Scala-ever-remove-XML-literals Summary: No. At the time that Scala was started, built-in support for XML showcased one area were object-oriented decomposition failed and functional programming proved quite useful. Today the benefits of FP are more well known, and it's generally agreed that if Scala were starting from scratch it…

Solution: move it to a library, like perl did with it's format syntax, and take it out of core.

Re: Scala: The Static Language that Feels Dynamic (Bruce Eckel)

#27

Gosu has the same dynamic feel in a statically typed JVM language, with much less complexity. (I should mention Fantom too, although I'm much less familiar with it.) Artima appears to have gone all-scala-all-the-time at some point in 2010. Weird.

Scala looks complex on paper, but my experience has been that in practice it's not that bad. If you're designing a library you need to think hard about types but you can put together an app very quickly in Scala and with a lot fewer initial bugs than in a dynamically typed language.

You could say the same thing about C++

The reality is that complex features will be used and abused.

Re: Scala: The Static Language that Feels Dynamic (Bruce Eckel)

#28
post #25

Earlier quoted context omitted.

Scala forces you to consider your library interface more carefully. This makes it more work to build a library but I think it pays off in a cleaner, more consistent and self-documenting library. Scala makes you think a little harder in general but, in my experience, you also write better code. All that painful refactoring and modularization that went into Rails 3 would have been a lot easier and, I suspect, less nece…

I think of it more in terms of natural selection. If, and this is a big if, diversity is greater in language x than in language y due to ease of trying ideas, then there is more opportunity to hit on good ideas.

The barrier to entry in Scala is definitely higher, and I do think this has limited its growth. To be honest, I don't think Scala is going to be the FP lang that really goes big, although I wish it were.

I just hope Scala gets enough traction that I can find real work in the language. After using it for a while languages like Ruby and Python just feel primitive.

Re: Scala: The Static Language that Feels Dynamic (Bruce Eckel)

#29
post #26

Earlier quoted context omitted.

See my answer on Quora to "Will Scala ever remove XML literals?" http://www.quora.com/Will-Scala-ever-remove-XML-literals Summary: No. At the time that Scala was started, built-in support for XML showcased one area were object-oriented decomposition failed and functional programming proved quite useful. Today the benefits of FP are more well known, and it's generally agreed that if Scala were starting from scratch it…

Solution: move it to a library, like perl did with it's format syntax, and take it out of core.

This is hard because Scala's XML support affects the parser. At the lexical level. Scala does have compiler plugins, but it doesn't have parser plugins.

Re: Scala: The Static Language that Feels Dynamic (Bruce Eckel)

#30
I believe JVM now supports some restricted form of class re-definition at run time in debug mode. But it is quite limited. This is probably old hat for JVM hackers, I do not keep myself updated on the Java/JVM side of things.

I came across Sun's (now Oracle's?) open-source(GPL) fork of the JVM that allows for changing class internals on the fly. The following analogy comes to mind DCE VM : JVM :: DLR : CLR

I quote:

  The class data structures of the Java HotSpot virtual
  machine are immutable during the execution of a program.
  While new classes can be loaded, it is not possible to
  change existing classes (e.g. add/remove methods or
  fields). This projects tries to relax this condition to
  allow arbitrary changes to existing Java classes
  (including changes to the class hierarchy) while running
  a Java program.
This looks interesting http://ssw.jku.at/dcevm/ and wonder if runtimes of dynamic languages could make use of this.
Post reply on HN