jducoeur: (Default)
jducoeur ([personal profile] jducoeur) wrote 2013-11-22 01:29 pm (UTC)

Note: Scala's importing is more or less identical to Java's, by design -- one of Scala's great strengths *and* weaknesses is that it is nearly 100% Java-compatible, so that it can use Java libraries and be used to write them. It has a somewhat more flexible and powerful import mechanism (eg, you can import locally to any block), but in general you basically wind up importing mostly the same stuff as Java.

It meant I never had to say "import java.net.*", however, because I could just name a class and IntelliJ would find it for me and ask to import it (or do that automatically).

Yeah, there's a part of me that misses that feature of Visual Studio (I was very used to doing that in C#). But I now find myself wondering if the discipline of writing my own imports may be healthy.

In MATLAB there is a more serious implication in that some language features actually are separate products and must be bought separately. Knowing what you're using becomes crucial there, especially if you plan on sharing your code with others.

That's increasingly true of Scala nowadays as well. The "language" per se is global -- but it's always been immensely flexible, allowing you to write you own operators and such, and internal DSLs for special purposes ranging from parsing to XML literals are increasingly common.

And now that they're introducing high-powered macros (essentially compile-time Scala code for doing AST transforms), that's going to be more and more true -- you can modify the language in nearly-arbitrary ways with your imports. Damned useful, but a tad dangerous.

JS had no decent import mechanism, just including a whole file.

Yeah, this has always been my biggest complaint about JS, and was a *huge* fight at Memento (where I was leading the client team, and engaged in a year-long argument about Flash vs. JS with one of the other architects). The lack of good modularization tools has always made it hard for me to take JS seriously for really complex projects...

Post a comment in response:

(will be screened)
(will be screened if not validated)
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting