Planet Lang
Cloudfork AWS packages and some rough edges
If you want to get started with Cloudfork AWS you need to know what packages to load and what the prerequisites are. The current implementation also has some rough edges that you need to be aware of. As mentioned on SqueakSource the prerequisite packages are:
- Cryptopraphy Team Package version 1.1
- HTTPClient version 19
The Cryptography package is needed for the HMAC-SHA1 or HMAC-SHA256 signature functions. Amazon won’t accept your requests without them. The HTTPClient is needed for handling the HTTP REST calls. Both prerequisites can be loaded using the Universe Browser.
PackagesFor Cloudfork AWS you need to load three packages using Monticello:
Cloudfork-AWS: The main package, this package contains most of the code. Only the Smalltalk dialect specific functionality has been factored out.
Cloudfork-Squeak-Platform: Package with functionality that we think is Squeak specific. This is mostly done by subclassing base classes from Cloudfork-AWS.
Cloudfork-Tests-AWS: This optional package contains unit and integration tests. They can be used to verify that everything works correctly and especially the integration tests give a good example on how the API’s can be used.
We have used the Seaside 2.9 project as a good example on how to setup the package structure. Also note that before you can actually run the integration tests you need an AWS account that is enabled for the specific service you want to test (SimpleDB, SQS or S3). You can set your AWS account credentials using the class method defaultAwsKey: awsKey andSecret: aSecret of the class CFAWSIntegrationTest.
Rough edgesAlthough the package are already usable there are still some rough edges you need to be aware of:
- Time zones - Every request you send to AWS needs to have a timestamp or expiration date. If this timestamp is off by more than 15 seconds or so the request will be denied. The timestamp you send to AWS needs to have the correct time zone, or better yet, it needs to be converted to UTC (Coordinated Universal Time / Greenwich Mean Time). We haven’t yet figured out how to get the “current” time zone in Squeak. Instead we have hard coded the difference between our Central European Time time zone and UTC. If you live somewhere else you need to change this:
- For SQS and SimpleDB this is done in the class method encodeRFC3339Date: aDateTime of the class CFServiceSqueakUtils.
- For S3 this is done in the class method encodeRFC822Date: aDateTime of the class CFServiceSqueakUtils.
(yes, we know this is ugly and we will change this shortly).
- Proxy support - If you want to use Cloudfork AWS from behind a proxy you need to define this somewhere. We haven’t yet made a public method to configure this. For now you will need to change the initialize method of CFAWSRESTSqueakAccess. The comment contains a sample proxy definition.
- HTTPS - All the AWS services with a REST based interface can be used with plain HTTP and with secure HTTP (HTTPS). Until now we have only tested with plain HTTP.
- UTF-8 - Alls HTTP calls to AWS should be encoded using UTF-8 Currently this works for the standard characters . We have not done any testing with special / non-western characters.

Know your place in life is where you want to be.
Resolutions for 2009…
- Have an almost (if not complete) “ready-to-hit-the-market” baseball game before June;
- Of all the stuff I haven’t read from the “top 100 novels” list ( I must admit that I completed my list recently and now I’ve got more than 200 books on it!), read everything I haven’t read (okay, it’ll take more than one year to do!);
- Appreciate silence and music again;
- Appreciate playing chess again even though I am sooooooooo far away from that kid who played chess tournaments at 15;
- Why dream about being a novelist? It’s about time I start writing… I have dreamed long enough about doing it, now I have to do it… One page at a time, that’s the key;
- A few road trips to plan (or do!)… Tuktoyaktuk, Old Orchard Beach (in the winter of course!), Fermont and any other destination that one of my friends can suggest and that sounds like a sooooooooo stupid idea (all I need is an excuse as in : baseball, rock concert, “why not”, lots of snow, etc);
- Stop by Cleveland… More than 24 hours. Progressive rocks and I miss you guys;
- Gauss and Riemann were just so ahead of their time! Read all I can read about them and keep that secret (I know I’m a geek… sometimes!);
- Play snooker and poker a little bit more often;
- See friends I haven’t seen for a too-long-period-and-that-is-my-own-fault;
- Take care of the one I love and our three princesses.
Mary Laycock
"mathematicians turned great math teachers (such as Mary Laycocke) who have spent decades learning how to get young children to learn "real math" "
http://www.activityresources.com/store/catalog/
The hands on manipulatives and other resources look great:
- Fraction Tiles,
- Weaving your way from arithmetic to mathematics,
- Graphiti,
- Puzzling your way into Algebra
http://openlibrary.org/a/OL3631937A
Books by Mary Laycock with intriguing titles such as Skateboard Practice, Tapestry of Mathematics, Straw Polyhedra, Correlation of Activity-Centred Science and Mathematics
I wish some of these old books could be digitised and put into the public domain, they might get a new lease of life that way.
I looked up one of them, Skateboard Practice, in google books search and found other books that refer to them, they are obviously great resources
eg.
http://books.google.com/books?id=rHYmAAAACAAJ&source=gbs_ViewAPI
cites another book that uses Skateboard Practice as a resource
http://books.google.com/books?id=jDXAj-ym6xYC&pg=PA54&vq=%22Skateboard+Practice%22&source=gbs_book_citations_r&cad=0_2
cites some of the activities from this book and how this teacher used them
It would be good if young educational software developers took some time out to check out these works by an old master
Timestamping F# assembly versions
Following up to the previous post, with the usual caveat about needing to put spaces around angle-brackets for the syntax highlighter, with this script Timestamp.fsx
#light open System
open System.IO let format = "#light
open System.Reflection;
open System.Runtime.CompilerServices;
open System.Runtime.InteropServices; // General Information about an assembly is controlled through the following set of attributes.
[< assembly: AssemblyTitle(\"your assembly name\") >]
[< assembly: AssemblyDescription(\"\") >]
[< assembly: AssemblyConfiguration(\"\") >]
[< assembly: AssemblyCompany(\"Your co.\") >]
[< assembly: AssemblyProduct(\"Your product\") >]
[< assembly: AssemblyCopyright(\"Copyright © you, 2009\") >]
[< assembly: AssemblyTrademark(\"\") >]
[< assembly: AssemblyCulture(\"\") >] [< assembly: ComVisible(false) >] [< assembly: AssemblyVersion(\"1.0.{0}\") >]
[< assembly: AssemblyFileVersion(\"1.0.{1}\") >]
()" let now = DateTimeOffset.UtcNow
let epoch = new DateTimeOffset(2000, 1, 1, 0, 0, 0, new TimeSpan(int64 0))
let diff = now.Subtract(epoch)
let fraction = diff.Subtract(TimeSpan.FromDays(float diff.Days))
let revision= ((int fraction.TotalSeconds) / 2)
let version = String.Format("{0}.{1}", diff.Days, revision) File.WriteAllText ("AssemblyInfo.fs", String.Format (format, version, version))
suitably adjusted to taste in your main project folder, and a pre-build step of
cd ..\.. "C:\Program Files\FSharp-1.9.6.2\bin\fsi.exe" --exec Timestamp.fsx
you can get an automatically timestamped assembly, as per a C# 1.0.* version.
Note that using [< assembly: AssemblyVersion(\"1.0.*\") >] gives an assembly version of 0.0.0.0 in the DLL manifest, and no file version whatsoever.
You will have to bootstrap the process by creating a dummy AssemblyInfo.fs, and adding it to the project -- but of course not checking it in to source control or anything like that, since it is recreated every build.
Saturday January 10th 2009, 2PM: FringeDC Programming Group Formal Meeting
Erlang Exposed! Chris Williams from NOVAlanguages (http://tinyurl.com/9o859p) will be giving an intro to Erlang and will describe what makes it so cool. You'll learn how the Erlang Concurrency Model allows for robust multiprocessor and distributed computing. As an opening presentation, Conrad Barski will present some new software written in Arc Lisp for automated cartoon cell colorization. Afterwards, we'll head over to a Mongolian Grill for some beer and conversation.
The meeting is generously hosted by Clark & Parsia (http://tinyurl.com/6wmmbj) located at 926 N St NW REAR Studio #1 Washington DC and is near the Convention Center Metro Stop. (Map http://tinyurl.com/7mbc4o) Anyone is welcome to join our meetings!
FringeDC is a programming group in Washington DC interested in Functional and Fringe programming languages (Lisp, Haskell, Erlang, etc) http://lisperati.com/fringedc.html
Higher Order abstractions in Scala with Type Constructor Polymorphism
In this post, I discuss the already introduced intimidating phrase "Type Constructor Polymorphism" through a series of code snippets ranging from toys to some real-world stuff. The idea is, once again, not to evangelize type theory intricacies, but share some of the experiences of how this feature in Scala's type system can help write idiomatic code, while staying away from the complexities of its underlying implementation.
Jump on ..
We have a list of
Option[String] that we need to abstract over and compute some value. Say, for the sake of keeping the example simple, we will calculate the sum of lengths of all the strings present ..val employees: List[Option[String]] =
List(Some("dave"), None, Some("john"), Some("sam"))
val n: List[Int] =
employees.map { x =>
x match {
case Some(name) => name.length
case None => 0
}
}.elements.reduceLeft[Int](_ + _)
println(n)
Let us take another problem that needs to abstract over a different
List structure, a List of List of Strings, and compute the same result as before, i.e. the sum of lengths of all the strings encountered in the collection ..val brs: List[List[String]] =
List(List("dave", "john", "sam"), List("peter", "robin", "david"), List("pras", "srim"))
val m: List[Int] =
brs.flatMap {x => x.map {_.length}}
.elements.reduceLeft[Int](_ + _)
println(m)
Do you see any commonality in the solution structure in the above snippets ? After all, the problem space has a common generic structure ..
- we have a
Listwith someStringvalues abstracted in different forms - need to iterate over the list
- do some stuff with elements in the list and compute an
Intvalue
Unfortunately the actual solution structures look quite different and have to deal a lot digging into the abstractions of the underlying representations within the collection itself. And this is because, we cannot abstract over the type constructor (the List in this case) that takes another type constructor as an argument (
Option[String] in the first case and List[String] in the second case).Enter type constructor polymorphism.
Sounds intimidating ? Maybe, but ask the Haskellers .. they have been using typeclasses ever since so successfully in comprehensions, parser combinators and embedded DSLs and programming at a different level of abstraction.
Scala supports type constructor polymorphism since 2.5, and the details have been discussed in a recent paper by Adriaan Moors et al in OOPSLA 2008.
Here is a snippet of the Scala code that works seamlessly for both of the above cases ..
val l: List[Int] = employees.flatMapTo[Int, List]{_.map{_.length}}
val sum: Int = l.elements.reduceLeft[Int](_ + _)
println(sum)
The above code abstracts over
List through higher order parametric polymorphism, i.e. independent of whether the List parameter is an Option[] or another List[]. Incidentally both of them (List and Option) are monads and flatMapTo abstracts a monadic computation, hiding all details of type constructor polymorphism from the developer.Now here is some real life example (elided for simplicity) ..
Here are the simple domain models for
Customer, Instrument and Trade, used for modeling a use case where a Customer can order for the Trade of an Instrument in an exchange.case class Customer(id: Int, name: String)
case object nomura extends Customer(1, "NOMURA")
case object meryll extends Customer(2, "MERYLL")
case object lehman extends Customer(3, "LEHMAN")
case class Instrument(id: Int)
case object ibm extends Instrument(1)
case object sun extends Instrument(2)
case object google extends Instrument(3)
case class Trade(ref: Int, ins: Instrument, qty: Int, price: Int)
And we fetch the following list through a query from the database. It is a
List of tuples where each tuple consists of a Customer and a trade that has been executed based on the Order he placed at the exchange. And here is the snippet of the code that computes the sum total of the values of all trades executed in the day for all customers.val trades: List[(Customer, Option[Trade])] =
List((nomura, Some(Trade(100, ibm, 20, 12))),
(meryll, None), (lehman, Some(Trade(200, google, 10, 10))))
val ts: List[Option[Trade]] = trades.map(_._2)
val t: List[Int] = ts.flatMapTo[Int, List]{_.map{x => x.qty * x.price}}
val value = t.elements.reduceLeft[Int](_ + _)
println(value)
Really not much different from the above simple cases where we were dealing with toy examples - isn't it ? The structure of the solution is the same irrespective of the complexity of data being stored within the collections. The iteration is being done at a much higher level of abstraction, independent of the types stored within the container. And as I mentioned above,
flatMapTo is the secret sauce in the above solution structure that abstracts the building of the new container hiding the inner details. To get more into the innards of flatMapTo and similar higher order abstractions, including the new form of Iterable[+T], have a look at the OOPSLA paper referenced above.Postscript: In all the snippets above, I have been explicit about all type signatures, just for the sake of easier understanding of my passionate reader. In reality, almost all of these will be inferred by Scala.
Monadic Constraint Programming
Abstract:
A constraint programming system combines two essential components: a constraint solver and a search engine. The constraint solver reasons about satisfiability of conjunctions of constraints, and the search engine controls the search for solutions by iteratively exploring a disjunctive search tree defined by the constraint program. In this paper we give a monadic definition of constraint programming where the solver is defined as a monad threaded through the monadic search tree. We are then able to define search and search strategies as first class objects that can themselves be built or extended by composable search transformers. Search transformers give a powerful and unifying approach to viewing search in constraint programming, and the resulting constraint programming system is first class and extremely flexible.
Let's briefly look at the n queens example from the paper. First, there is the nqueens model:
nqueens n = exist n $ \queens -> model queens n /\
enumerate queens
model queens n = queens ‘allin‘ (1,n) /\
alldifferent queens /\
diagonals queens
allin queens range = conj [q ‘in_domain‘ range | q - queens ]
alldifferent queens = conj [ qi @\= qj | qi:qjs - tails queens,
qj - qjs ]
diagonals queens = conj [ qi @\== (qj @+ d) /\ qj @\== (qi @+ d)
| qi:qjs - tails queens, (qj,d) - zip qjs [1..]]
conj = foldl (/\) true
The enumeration of possible values can be quite sophisticated, e.g.
enumerate = Lazy . (label firstfail middleout)
where firstfail selects the queen with the smallest
domain first, and middleout selects the middle values
in the domain first. You can easily write custom variable and
value selection strategies, or alternative enumeration functions.
To actually compute solutions, we have to solve the model:
> solve dfs it $ nqueens 4
[[2,4,1,3],[3,1,4,2]]
i.e. we yields these two solutions of 4 queens:


The search strategy used above is depth-first search (dfs) without
any additional search transformers (i.e. identity transformer it).
Here are three variations, using alternative search strategies:
> solve dfs (nb 100 :- db 25 :- bb newBound) $ nqueens 4
> solve bfs (db 25 :- nb 100 :- bb newBound) $ nqueens 4
> solve bfs (ld 10 :- nb 100 :- bb newBound) $ nqueens 4
where
- bfs is the breadth-first queueing strategy,
- nb n stops search after visiting n nodes in the search tree,
- dbn does not visit nodes below depth n in the search tree,
- ld n does not visit nodes that are more than n right branches from the root of the search tree (limited discrepancy), and
- bb newBound is branch-and-bound optimization (in this example the value of the last queen is minimized; makes more sense for other problems).
The :- operator combines the various (composable) search transformers. The purpose of these search transformers is of course to find (all, one, the best) solutions more quickly.
More
- Draft paper
- Prototype code (requires GHC >= 6.10)
Your feedback is appreciated.
.NET Toolkit Released, Command Line Tools Updated
Our .NET PDF Toolkit, in 100% F#, cross-compiled with OCaml is now available, starting at £495. It does everything the command line tools do, and more, but is usable natively from VB.NET, C# and ASP.NET.
At the same time, we’ve updated the Command Line Tools (written in pure OCaml) with bug fixes and new features, and now provided for Solaris 10 Sparc and Intel out of the box.
The codebase of about 40,000 lines ended up requiring only 30 points at which conditional compilation was needed to cover the differences between F# and OCaml, though plenty of code had to be modified to compile in both environments in a way that didn’t require conditional compiltion.
There will be a new release of CamlPDF soon, which will have many new features, and which will cross-compile with F# out of the box.
links for 2009-01-05
-
GeKoN est un système d'informations géographiques écrit en Smalltalk
-
Ce qui s'est passé en robotique en 2008 et ce qui se passera en 2009
-
Third International Workshop on Software Development and Integration in Robotics (SDIR 2008)
-
4th International Workshop on Software Developement and Integration in Robotics (SDIR 2009)
-
Une machine que j'ai utilisé chez mon oncle Jean-Pierre Vançon dans les années 80.
Large set of ejabberd resources
Since its relaunch, Planet Erlang is now indexing content from tens of Erlang related blogs. Thank to its search engine, you can now find many blog posts and articles on lots of different Erlang topic. ejabberd is one of the most covered topic there.
You should have a look and try searching for ejabberd in the search engine (search field on the right).
The list of resources is growing every day as we are adding even more older resources.
Your comments and feature requests are welcome !
Lightweight controls, VSLab and F#
November and december have been busy months and time was short to find enough time to write about VSLab. However, things are going on and we are planning a new release of VSLab soon. The major contribution is from Giacomo Righetti, who has spent time for building a framework of lightweight controls using a former definition from me. Lightweight controls are missing from Windows Forms, and now you can have them in F# (and .NET languages). Giacomo implemented a set of predefined controls such as buttons, scrollbars, and many others so that viewlet development becomes easier. The VSLab shell project is also going on, and actually I have configured my Acer aspire one to start VSLab as a system shell :) I don't really miss Windows explorer... (ok, ok, I know I'm a little bit biased!).
GHC / OpenSPARC Project: Bootstrapping 3
cc004.hs:16:0:
calling convention not supported on this architecture: stdcall
When checking declaration:
foreign import stdcall safe "static &p" m_stdcall
:: StablePtr a -> IO (StablePtr b)
Started teasing out the SPARC stuff from nativeGen/MachCodeGen.hs. At the moment it's a mess of #ifdefery. I'm sure #ifdefs were the best way to do it back then there were only one or two targets, but now there is code for i386, i386_64, powerpc, alpha and sparc all mixed in together.
My plan is to copy out the non-architecture-specific functions from nativeGen/MachCodeGen.hs into their own module nativeGen/MachCodeGenShared.hs. I'll split the sparc specific stuff into a set of modules under nativeGen/sparc. Once the sparc native gen works again I'll then go back and delete the sparc specific stuff from nativeGen/MachCodeGen.hs, and make it use the MachCodeGenShared.hs. This should leave the original support for all architectures untouched during development.
While going through the code, found an amusing comment in the sparc section:
-- Floating point assignment to a register/temporary
-- ToDo: Verify correctness
assignReg_FltCode :: Size -> CmmReg -> CmmExpr -> NatM InstrBlock
assignReg_FltCode pk reg src = do ...
hmmm. I wonder how long that ToDo has been there..
The build of GCC 4.3.2 died with
Configuring stage 1 in sparc-sun-solaris2.10/libgcc
...
checking for suffix of object files... configure: error: cannot compute
suffix of object files: cannot compile.
Investagation of the config.log reveals:
/home/benl/files/gcc/build/gcc-4.3.2-obj/./gcc/xgcc ...
conftest.c:1: internal compiler error: Segmentation Fault
Please submit a full bug report,
Tried to back off to GCC 4.2.1 then GCC 4.2.4. Both die during the build with configure problems:
config.status: executing gstdint.h commands
make[3]: Entering directory `/home/benl/files/gcc/build/gcc-4.2.4-obj/libdecnumber'
make[3]: Nothing to be done for `all'.
make[3]: Leaving directory `/home/benl/files/gcc/build/gcc-4.2.4-obj/libdecnumber'
make[3]: Entering directory `/home/benl/files/gcc/build/gcc-4.2.4-obj/gcc'
make[3]: *** No rule to make target `all'. Stop.
make[3]: Leaving directory `/home/benl/files/gcc/build/gcc-4.2.4-obj/gcc'
For some reason the configure script isn't dropping the Makefile in ./gcc.
Giving up trying to compile a more recent GCC under Solaris. Will just copy the 4.2.1 binaries across from mavericks. Let's hope we don't stumble across any more bugs in it.
Stop. Rewind. I've been tripping over myself because the builds are taking so long. I've got copies of the head on mavericks, code.haskell.org and sparky and they're all different versions. Some of the recent patches pushed to the head also seem to have broken the build, so I'm backing up to the head as of 2009/01/01.
I'm going to stick with this version, and the same compiler flags, for all builds until the NGC is fixed. I need to be able to reuse the .o files between builds because they take too long to remake.
Finally pushed the gc_thread patch. This should fix the via-c build. I've run through the testsuite, though I'm still waiting the actual stage2 build to finish - it's stuck on Parser.hs again.
Turned on the NCG for sparc. That'll be another nights worth of rebuilding.
Joint Compilation of Scala and Java Sources
One of the features that the Groovy people like to flaunt is the joint compilation of .groovy and .java files. This is a fantastically powerful concept which (among other things) allows for circular dependencies between Java, Groovy and back again. Thus, you can have a Groovy class which extends a Java class which in turn extends another Groovy class.
All this is old news, but what you may not know is the fact that Scala is capable of the same thing. The Scala/Java joint compilation mode is new in Scala 2.7.2, but despite the fact that this release has been out for more than two months, there is still a remarkable lack of tutorials and documentation regarding its usage. Hence, this post…
ConceptsFor starters, you need to know a little bit about how joint compilation works, both in Groovy and in Scala. Our motivating example will be the following stimulating snippet:
…and the Java class:
If we try to compile foo.scala before Bar.java, the Scala compiler will issue a type error complaining that class Bar does not exist. Similarly, if we attempt the to compile Bar.java first, the Java compiler will whine about the lack of a Foo class. Now, there is actually a way to resolve this particular case (by splitting foo.scala into two separate files), but it’s easy to imagine other examples where the circular dependency is impossible to linearize. For the sake of example, let’s just assume that this circular dependency is a problem and cannot be handled piece-meal.
In order for this to work, either the Scala compiler will need to know about class Bar before its compilation, or vice versa. This implies that one of the compilers will need to be able to analyze sources which target the other. Since Scala is the language in question, it only makes sense that it be the accommodating one (rather than javac).
What scalac has to do is literally parse and analyze all of the Scala sources it is given in addition to any Java sources which may also be supplied. It doesn’t need to be a full fledged Java compiler, but it does have to know enough about the Java language to be able to produce an annotated structural AST for any Java source file. Once this AST is available, circular dependencies may be handled in exactly the same way as circular dependencies internal to Scala sources (because all Scala and all Java classes are available simultaneously to the compiler).
Once the analysis phase of scalac has blessed the Scala AST, all of the Java nodes may be discarded. At this point, circular dependencies have been resolved and all type errors have been handled. Thus, there is no need to carry around useless class information. Once scalac is done, both the Foo and the Baz classes will have produced resultant Foo.class and Baz.class output files.
However, we’re still not quite done yet. Compilation has successfully completed, but if we try to run the application, we will receive a NoClassDefFoundError due to the fact that the Bar class has not actually been compiled. Remember, scalac only analyzed it for the sake of the type checker, no actual bytecode was produced. Bar may even suffer from a compile error of some sort, as long as this error is within the method definitions, scalac isn’t going to catch it.
The final step is to invoke javac against the .java source files (the same ones we passed to scalac) adding scalac’s output directory to javac’s classpath. Thus, javac will be able to find the Foo class that we just compiled so as to successfully (hopefully) compile the Bar class. If all goes well, the final result will be three separate files: Foo.class, Bar.class and Baz.class.
Although the concepts are identical, Scala’s joint compilation works slightly differently from Groovy’s from a usage standpoint. More specifically: scalac does not automatically invoke javac on the specified .java sources. This means that you can perform “joint compilation” using scalac, but without invoking javac you will only receive the compiled Scala classes, the Java classes will be ignored (except by the type checker). This design has some nice benefits, but it does mean that we usually need at least one extra command in our compilation process.
All of the following usage examples assume that you have defined the earlier example in the following hierarchy:
- src
- main
- java
- Bar.java
- scala
- foo.scala
- target
- classes
# include both .scala AND .java files scalac -d target/classes src/main/scala/*.scala src/main/java/*.java javac -d target/classes -classpath $SCALA_HOME/lib/scala-library.jar:target/classes src/main/java/*.javaAnt
One thing you gotta love about Maven: it’s fairly low on configuration for certain common tasks. Given the above directory structure and the most recent version of the maven-scala-plugin, the following command should be sufficient for joint compilation:
mvn compile
Unfortunately, there have been some problems reported with the default configuration and complex inter-dependencies between Scala and Java (and back again). I’m not a Maven…maven, so I can’t help too much, but as I understand things, this POM fragment seems to work well:
You can find more information on the mailing-list thread.
BuildrJoint compilation for mixed Scala / Java projects has been a long-standing request of mine in Buildr’s JIRA. However, because it’s not a high priority issue, the developers were never able to address it themselves. Of course, that doesn’t stop the rest of us from pitching in!
I had a little free time yesterday afternoon, so I decided to blow it by hacking out a quick implementation of joint Scala compilation in Buildr, based on its pre-existing support for joint compilation in Groovy projects. All of my work is available in my Buildr fork on GitHub. This also includes some other unfinished goodies, so if you want only the joint compilation, clone just the scala-joint-compilation branch.
Once you have Buildr’s full sources, cd into the directory and enter the following command:
rake setup install
You may need to gem install a few packages. Further, the exact steps required may be slightly different on different platforms. You can find more details on Buildr’s project page.
With this highly-unstable version of Buildr installed on your unsuspecting system, you should now be able to make the following addition to your buildfile (assuming the directory structure given earlier):
Just like Buildr’s joint compilation for Groovy, you must explicitly require the language, otherwise important things will break. With this slight modification, you should be able to build your project as per normal:
buildr
This support is so bleeding-edge, I don’t even think that it’s safe to call it “pre-alpha”. If you run into any problems, feel free to shoot me an email or comment on the issue.
ConclusionJoint compilation of Java and Scala sources is a profound addition to the Scala feature list, making it significantly easier to use Scala alongside Java in pre-existing or future projects. With this support, it is finally possible to use Scala as a truly drop-in replacement for Java without modifying the existing infrastructure beyond the CLASSPATH. Hopefully this article has served to bring slightly more exposure to this feature, as well as provide some much-needed documentation on its use.
Sendfile for Yaws
Links for 5-Jan
Just a small selection from the last week or so, and not even trying to keep up with PoSh v2CTP3 goodness -- I will be so pleased when that gets to go-live state!
AssemblyInfo.fs usage for F# DLLS and console executables. Note that the ability to default build and revision numbers as in [<assembly: AssemblyVersion("1.0.*")>] is not provided for you -- time-stamping has to be done externally e.g. by a pre-build step.
Avoiding deadlocks when redirecting stdin/out/err for spawned processes in .Net code.
Speech recognition with .Net 3 and speech synthesis too!

Recent comments