The scala plugin seems to automatically download version 2.8 of Scala. I'l like to try out the Gridgain 3.0-beta, which currently only works with Scala 2.7.7. Since Gridgain 3.0-beta already provides scala-compiler-2.7.7.jar and scala-library-2.7.7.jar, is it possible to get the Eclipse Scala Plugin to compile to Scala 2.7.7?
I tried removing the Scala Library 2.8 from the project build path and added both the 2.7 jars, but this didn't seem to work.
Would this be easier if I switched to Netbeans?
Both the Eclipse plugin and the NetBeans plugin use the Scala Compiler for a lot of things from the simple stuff like syntax highlighting to stuff like type inference, resolution and display of implicits to more involved stuff like automated type-driven refactorings and semantic highlighting.
And more specifically, they use the 2.8 compiler, because the 2.8 compiler has a completely refactored API and a new framework (the so-called presentation compiler), which is specifically designed for IDEs, so that they can get all the information they need out of the compiler, but also can feed information (like in the case of refactorings) back into the compiler.
So, in short: the version of the plugin is closely coupled to the version of the compiler, and the compiler in turn only supports one version of the language. In particular, the IDE plugins require a 2.8 version of the compiler, because they use the new presentation compiler framework, and the 2.8 compiler does not support the 2.7 language.
This tight coupling is of course not a good thing, and it will get broken up in the future, but for now, you are stuck.
You could try the IntelliJ IDEA IDE and their Scala plugin. As far as I know, they have written their own compiler (well, at least the parts they need for syntax highlighting and refactoring purposes) purely from the Scala Language Specification, without using any of the Scala Compiler APIs. The Scala Plugin does work with the Community Edition.
The best place for questions like this is the Scala IDE user mailing list. But in brief, the Eclipse tooling for Scala doesn't support the use of other versions of the Scala compiler and libraries than the ones which it ships with. This is unlikely to change in the foreseeable future.
Related
Have anyone tried to write a Netbeans RCP application in scala (Instead of Java). The reason for my question there is an API in Scala which wraps JavaFX. Likewise is there any API to make to develop Netbeans RCP based apps written in scala.
For wrapping JavaFX there is ScalaFX. Netbeans Rich Client Platform is not small, and a Scala wrapper seems impractical to me (I am not aware of any); just call the Java code from Scala. Java/Scala interoperability is generally decent, so while you might occasionally have to write a little bit of Java as an interface, you can pretty much just use Scala for any Java project.
(Getting the build process to work might be a little tricky, though; expect to invest a little time there.)
I personally dont see any useful use case to use JVM language to develop NB RCP/Plugin. NB It self provides a IDE where you can use the drag-drop feature, codegen, annotation based IDE to created it. If you want to have a syntax sugar in writing NB RCP then i feel its waste of time where we already have a good IDE. JVM is not going to do any much difference that the existing environment.
If you see that you need a NB like modular, GUI based framework in Scala ecosystem that, I personally feel writing binding wont solve that problem. Scala need some framework like Griffon.
I am new to Scala. However, I a created a medium size program with Scala 2.9.0. Now I want to use an open source library which is only available for Scala 2.7.7.
Is it possible to use this 2.7.7 library in my Scala 2.9.0 program? How can I do it? I had already a look at sbt but did not really succeed. Has someone a hello world example for this?
It should be possible in principle using a custom classloader for the 2.7.7 jar and custom wrappers. But practically, since the library is open source, it's very likely that it would be less work to recompile it with 2.9 and make those changes which are required. (There usually aren't many.)
Typesafe has an early preview of a migration manager (http://typesafe.com/technology/migration-manager) which promises to report on and resolve binary incompatibilities. Apparently the early preview only report on incompatibilities, but it might be worth a shot.
The best approach would be to either use a maintained library or to update the code.
If you take the second option, compile the code with the flags -deprecation and -Xmigration.
This tells you what you need to change between versions.
I would like to use Scala and JMonkey Engine to create a small game. It should be nothing more than a test wether the engine is fun to use. I'm new to JMonkey and therefore don't know the usual method calls. Something like autocompletion would be nice but currently even the standard Scala autocompletion doesn's work. I downloaded JMonkey Engine, installed the standard Netbeans Scala Plugins. Now I can create Scala objects and classes but nothing more. Can you give me advice ?
Do you have really the latest version of the Scala Plugin? It seems to work (at least for me).
Just in case (it is a little bit hard to find):
For Scala 2.8: http://plugins.netbeans.org/plugin/36598/nbscala-2-8-x
For Scala 2.9: http://plugins.netbeans.org/plugin/38999/nbscala-2-9-x-0-9
BTW, there is a Scala 3D Engine (but still pretty alpha): Sgine
I've been reading up on Scala a lot recently and I really want to get into it. I do my Java web development from within Eclipse with Tomcat as my preferred server and I'd like to keep it that way. I've tried the Scala Eclipse plugin but it's safe to say, it isn't there yet. I had to uninstall it because it simply ins't working. On top of that, it doesn't seem to provide anything for doing web projects (I could be wrong there).
Since Scala is a compiled language just like Java is, I was wondering if it's possible to simply swap out Java with Scala, as in, where I'd normally would create Java classes I would now be able to create Scala classes instead? Maybe even mix Java and Scala?
Is there anyone out there who's been able to set up a decent Scala workflow in Eclipse for web development without the dreaded "official" Scala Eclipse Plugin?
PS: I've tried the Play framework (I think it recently added Scala support) but it simply isn't for me. I like my classes compiled and to use JSP's for my views.
You don't say anything about what version of the Scala IDE for Eclipse you were using, or what you tried to do to resolve your issues. I suggest that before changing your workflow you head over to http://groups.google.com/group/scala-ide-user and see if we can help you out.
Since Scala is a compiled language
just like Java is, I was wondering if
it's possible to simply swap out Java
with Scala, as in, where I'd normally
would create Java classes I would now
be able to create Scala classes
instead?
Yes, absolutely. That's one of Scala's big advantages over some other JVM languages.
Maybe even mix Java and Scala?
Yes, absolutely. That's one of Scala's big advantages over some other JVM languages.
Make sure you have familiarity with the Java and Scala collections libraries (and that you keep them straight -- if you're planning using advanced Scala features on Java collections, definitely use a Scala 2.8 release candidate). Also make sure you're faimilar with the #BeanProperty annotation -- it can simplify your Scala coding somewhat.
As Miles said, you should give us the version of Eclipse you are working with.
I'm also new to Scala and found difficult to work through Eclipse. I was using Eclipse Galileo 3.5.2 and found specially long to compile all the scala libraries. I switched to IntelliJ (IDEA 9.0.2) and I'm much more confortable now. I recomend trying it although it's more a personal matter.
Even so, I agree, the plugins are not there yet specially for web development. The great news is that you can use everything you have in Java and mix it with Scala. Since Scala is compiled to Java BitCode, they are totally compatible. See Combining Scala and Java.
When writing in Scala you always have (almost) all the Java libraries at your service plus anything you have created before. You will have to be carefull with the types (i.e. primitive types) but it normally works out very well.
I have been reading about Scala for a while and even wrote some small programs to better understand some of the more exoteric features.
Today I decided to do my first "real project", translating some 60 lines of ugly Java code to Scala to rewrite it using the better pattern-matching features (why? because the Java version was becoming hard to maintain due to excessive combination of regex and conditionals).
About halfway through the editing process, Eclipse thew up this error:
alt text http://img269.imageshack.us/img269/1243/errorms.jpg
I get the general impression that the Scala IDE in Eclipse is a lot buggier and less complete than its Java equivalent. Is this correct or do I just have a bad installation? Is there a better IDE for Scala?
I really like IntelliJ Idea Community Edition's Scala support. I've been using it from it's early days. I've also tested Netbeans and Eclipse plugins but I really don't like them that much. Especially all Eclipse Scala plugins are crap. I also tested Textmate Scala bundle, which is very nice but doesn't offer auto completion.
Here is my Scala Ide top list:
IntelliJ Idea Community Edition
Netbeans
Textmate (This is here, since I really like Textmate for writing Rails applications)
Eclipse
When you learn IntelliJ Idea keyboard shortcuts and add some live templates you can be very productive programmer. Furthermore, if you buy the Intellij Idea Ultimate Edition you can even share the settings with multiple computers or with your team.
What I suggest:
Download IntelliJ Idea Community Edition
Install the Scala plugin
Learn the keyboard shortcuts: Windows and Linux, Mac
Configure Live Templates when you get more familiar with the ide
The Eclipse IDE Scala support has not been great for some time, but is now receiving additional development effort alongside the introduction of Scala 2.8, and appears to be improving. For Scala 2.7 I have found the Intellij plugin to be in a better state.
One problem that both of these plugins have is that Scala itself is a moving target - Scala 2.8 has introduced additional syntax and structures to Scala 2.7.
From my own experience with Eclipse, using it for languages other than Java is never quite as good.
You might find this post of interest.
I get the general impression an IDE for a new, young, niche language is a lot buggier and less complete than a widespread, supported, mature language
Try Netbeans. Its plugins are generally of a simpler construction anyway, so should have less 'gotchas'
One point to make is that it is possible that people are still put off IntelliJ because they assume that the licence is expensive, especially if they are happy with Eclipse and are unaware of the Community Edition which is free and open source.
I cannot give any comparison with the other IDEs as I have always used IntelliJ, however the Scala support is certainly good, all things considered, and getting better.
We are using Eclipse Scala plugin at work and working with it is quite terrible. One cannot really trust reported errors inside IDE, runtime exceptions are the order of the day. Our best experience is with build from 25-11-2009.
At home I play with IntelliJ 9 and its Scala plugin and I find it much much better. I am newbie to IntelliJ but I am very impressed with all those little details which (once you get used to them) increase your productivity... a lot.
The drawback is in IntelliJ there is no compile-error reporting on the fly (at the time you're writing code) yet implemented and only Scala up to 2.7 is supported (2.8 by nightly builds only), but there are NO runtime exceptions while working with the IDE. I would recommend you to try IntelliJ, community edition at least.
I never really get on with IDEs at the best of times because they are usually pretty awful at actual text editing, but Eclipse's Scala plugin is particularly brittle to the point that projects "forget" that they are Scala after a while. Battling Eclipse seems to consume more effort than it saves. I just went back to my Emacs and sbt REPL in a terminal.
A light play with IntelliJ confirmed that it does at least do the job as a Scala IDE, but again I didn't care for its editor. It's also commercial software. However, if you are seeking a robust Scala IDE, this is perhaps where you should be looking.
What I have since settled on is perhaps perverse and not for the newcomer, but suits somebody who has definite opinions about their text editor. ENSIME is an editor plugin and server component that adds what you need from a Scala IDE to Emacs. It also claims support for vim, Atom, and Sublime, but I've not tested these. Occasionally it also has a bad day—obscure kinds of macros particularly confuddle it—but it generally does the job.