What are the key differences between the approaches taken by Scala and F# to unify OO and FP paradigms?
EDIT
What are the relative merits and demerits of each approach? If, in spite of the support for subtyping, F# can infer the types of function arguments then why can't Scala?
...
I'm trying to find the 'right' actor implementation for my thesis. I realized there is a bunch of them and it's a bit confusing to pick one. Personally I'm especially interested in remote actors, but I guess a complete overview would be helpful to many others. This is a pretty general question, so feel free to answer just for the impleme...
I've coded a parser based on Scala parser combinators:
class SxmlParser extends RegexParsers with ImplicitConversions with PackratParsers {
[...]
lazy val document: PackratParser[AstNodeDocument] =
((procinst | element | comment | cdata | whitespace | text)*) ^^ {
AstNodeDocument(_)
}
[...]
}
obje...
Let's say I have a Java class
abstract class Base {
abstract void init();
...
}
and I know every derived class will have to call init() after it's constructed. I could, of course, simply call it in the derived classes' constructors:
class Derived1 extends Base {
Derived1() {
...
init();
}
}
class Deri...
Hello,
I just wrote some NIO-code and wonder how to stress-test my implementation regarding
SocketChannel.write(ByteBuffer) not able to write the whole byte-buffer
SocketChannel.read(ByteBuffer) reading the data in chunks into ByteBuffer
are there some simple linux-utilities like telnet to open a ServerSocket with some buffering-op...
How do I parse an xml document as a stream using Scala?
I've used the Stax API in java to accomplish this, but I'd like to know if there is a "scala" way to do this.
...
Hello,
I'm working on a project with a friend. He's implementing his software in Ruby and I'm doing my stuff in Scala (with Lift). We're using some asynchronous encryption and he is using the ruby OpenSSL bindings for that:
key = OpenSSL::PKey::RSA.generate(4096)
self.public_key = key.public_key
self.private_key = key
What I'm loo...
I want to do syslogging from Java. There is a log4j appender, but it doesn't seem to work (for me anyway ... though Google results show many others with this issue still unresolved).
I'm trying to debug the appender, so I've written the following script based upon RFC3164
It runs, but no logging appears in the syslog.
// scala
import ...
I would like to know if it is possible to abstract the copy method of case classes. Basically I have something like sealed trait Op and then something like case class Push(value: Int) extends Op and case class Pop() extends Op.
The first problem: A case class without arguments/members does not define a copy method. You can try this in t...
Hi,
I am new to scala and actors. I need to implement such hypothetical situation:
Server wait for messages, if it does not get any in say 10s period of time, it sends message to the Client. Otherwise it receives messages incoming. If it is inside processing some message and another message comes, it needs to be queued (I suppose that ...
I am a fan of Martin Fowler's (deprecated) model-view-presenter pattern. I am writing a Scala view class containing several button classes. I would like to include methods to set the action properties of the buttons, to be called by the presenter. A typical code fragment looks like this:
private val aButton = new JButton
def setAButtonA...
I am newbie to Lift and I have a question on using bind, Ajax in Lift.
I want to create three dropdown menus using Ajax in a dynamic fashion. I use "Address" as an example to describe what I am trying to achieve. At fist, I only have to display "Country" menu with default set to "None". The user at this point can choose to submit if she...
I'm trying to find a cleaner alternative (that is idiomatic to Scala) to the kind of thing you see with data-binding in WPF/silverlight data-binding - that is, implementing INotifyPropertyChanged. First, some background:
In .Net WPF or silverlight applications, you have the concept of two-way data-binding (that is, binding the value of ...
I am generating large PNG files from a Scala program. Currently, I am doing it the same way I would do it in java. I am creating a new BufferedImage and setting each pixel to the correct color. This works fine, but I am wondering if there are any good libraries for working with images in Scala? I am looking for something like Ruby's ...
Hi guys, I was following http://www.assembla.com/wiki/show/liftweb/URL_Rewriting tutorial for url rewritting in liftweb.. but I get this error:
error: value rewrite is not a member of object net.liftweb.http.LiftRules
.. it is really odd.. and the documentation says that it exists.
I'm using idea IDE, and I've done everything from sc...
I have an enum Fruit defined as:
object Fruit extends Enumeration {
val Apple, Banana, Cherry = Value
}
Now printing values of this enum, on Scala 2.7.x gives:
scala> Fruit foreach println
line1$object$$iw$$iw$Fruit(0)
line1$object$$iw$$iw$Fruit(1)
line1$object$$iw$$iw$Fruit(2)
However the same operation on Scala 2.8 gives:
scal...
Hello
could somebody give me a start on how to parse the HTTP-protocol with scala 2.8 packrat-parsing?
I need to parse attached examplary HTTP Response into
ResponseStatusCode:Int
Headers:List[(String,String)]
Body: String, Array[Byte], CharBuffer
or whatever
Short examplary usage of a Packrat-Parser very much appreciated. Thanks!
...
I have a Scala project in Eclipse that I need to package up so I can deploy it to a server. It's based on Jetty but it runs as a standalone application. It contains Scala classes, Java classes and a number of 3rd party jars.
I assumed there would be some kind of deployment option in the Scala Eclipse plugin but I've drawn a blank.
What...
I like scala's propose of operator precedence but in some rare case unmodified rules may be inconvenient because you have restrictions in naming your methods. Is there in scala ways to define another rules for a class/file/etc? If not would it be resolved in future?
...
I have a Seq containing objects of a class that looks like this:
class A (val key: Int, ...)
Now I want to convert this Seq to a Map, using the key value of each object as the key, and the object itself as the value. So:
val seq: Seq[A] = ...
val map: Map[Int, A] = ... // How to convert seq to map?
How can I does this efficiently a...