Scala annotations, what actually is that?
I don't know Java. I started learning Scala. I can't imagine what and what for annotations are? Could someone explain me? ...
I don't know Java. I started learning Scala. I can't imagine what and what for annotations are? Could someone explain me? ...
Since scala.runtime.RichString is declared as final, you can't extend it like class MyString extends RichString. I'd like to 'pimp the library' and simply add another method. How would I do this? ...
Is there already any collection of best practices for languages like Scala? I've found a work on design patterns for functional languages here. There's GoF design patterns for oo languages. But are there any patterns for functional-oo hybrids? All I've seen is this list. Does anyone know any more? ...
I'm obviously missing something about why the following does not compile: trait SomeTrait{ def homepageClass[A <: SomeType]: Class[A] } class SomeOtherType extends SomeType object SomeObject extends SomeTrait{ def homepageClass = classOf[SomeOtherType] } ...
I'd like to implement a class C to store values of various numeric types, as well as boolean. Furthermore, I'd like to be able to operate on instances of this class, between types, converting where necessary Int --> Double and Boolean -> Int, i.e., to be able to add Boolean + Boolean, Int + Boolean, Boolean + Int, Int + Double, Double + ...
Does anyone know if something like this is possible in Scala: case class Thing(property:String) def f(thing:Thing, prop:String = thing.property) = println(prop) The above code doesn't compile; giving the error error: not found: value thing at thing.property The following shows the expected behaviour: f(Thing("abc"), "123") // print...
I have 2 simple methods in a scala library class: class Foo { def bar(args : String*) : Unit = println("Foo.bar with: " + args) def bar(args : Array[String]) : Unit = bar(args.toSeq : _*) } This all compiles nicely. I then put this in a library foo.jar and try and compile the following piece of Java: import Foo public class Test ...
What is the canonical way to get an empty array in Scala? new Array[String](0) is too verbose. ...
Hi there, I'm currently looking for a lexer/parser that generate Scala code from a BNF grammar (a ocamlyacc file with precedence and associativity) and I'm quite confused to find.. almost nothing: For parsing, I found scala-bison (that I have a lot of trouble to deal with). All the other tools are just Java parser imported into Scala (l...
I just recently encountered the term "Weak Conformance" (in retronym's answer to How to set up implicit conversion to allow arithmetic between numeric types?). What is it? ...
My project works absolutely fine on the Google Server but I get a VerifyError: java.lang.VerifyError: (class: org/restlet/ext/servlet/ServerServlet, method: createServer signature: (Ljavax/servlet/http/HttpServletRequest;) Lorg/restlet/engine/http/HttpServerHelper;) Incompatible object argument for function call UPDATE Through ex...
Do methods ending with _! such as delete_! or i_is_! have a special meaning? Are they "just names"? Do they follow some convention? There's even bulkDelete_!!. (The specific context is Lift if it makes a difference.) ...
Warning: I'm cross-posting from #scala The book Programming in Scala states that path-dependent types are different depending on the exact instance of the path in question. If so, I don't understand why all the following predicates return true: class Outer { val in = new Inner class Inner } val o1 = new Outer val o2 = new Outer o...
what is the purpose of scala.tools.util.SocketServer? ...
In java, I have a class like this: public class MyClass extends Properties { public StringProperty prop1 = new StringProperty(this, "default value for prop1"); public StringProperty prop2 = new StringProperty(this, "prop2 default val"); }//MyClass The parent class "Properties" uses reflection to look for all public fields in...
I am writing an interpreter and tried to use solution from how-to-set-up-implicit-conversion-to-allow-arithmetic-between-numeric-types for the same problem I need to be able to add Boolean + Boolean, Int + Boolean, Boolean + Int, Int + Double, Double + Double etc. So I used WeakConformance and C classes from that solution sealed trait...
I've tried different collections in Scala to sum it's elements and they are much slower than Java sums it's arrays (with for cycle). Is there a way for Scala to be as fast as Java arrays? I've heard that in scala 2.8 arrays will be same as in java, but they are much slower in practice ...
I have xml that looks like this: val xml = <plugins> <plugin type="x">plugin x</plugin> <plugin type="y">plugin y</plugin> </plugins> I am trying to write a match statement that finds the plugin with the attribute type="x". I tried: xml match { case <plugin type="x">{contents}</plugin> => println(contents) case _ => println(...
I'd like to do something like def getMeASammy() {println "getMeASammy"} def getMeADrink() {println "getMeADrink"} def getMeASub() {println "getMeASub"} But, I don't want to explicitly type out the name of the function. ...
What is the difference between Scala traits Haskell type class and C++0x Concepts? ...