1 Jan 2005 02:03
2 Jan 2005 21:24
2 Jan 2005 23:53
3 Jan 2005 10:05
Re: Default values
Philippe Altherr <Philippe.Altherr <at> epfl.ch>
2005-01-03 09:05:00 GMT
2005-01-03 09:05:00 GMT
> There's obviously a big difference between text substitution (which is what C++
> more or less does) and type substitution (which Scala does). Scalac _knows_ the
> types it is using to generate classes. C++ just mushes things together and sees
> if the result makes sense. At times, that can be convenient ;)
You can use mixins to do something similar to what C++ does with
templates. Indeed, in Scala, the code of mixed-in classes is simply
copied into the newly-defined class.
The example below defines the function "fact" only once and mixes it
in twice to obtain an "int" and a "double" version. The two
specialized versions really take and return
"int"s/"double"s. Unfortunately, their implementation really call the
methods declared in "Number" which is not very efficient. However, an
optimizer could rather easily inline all those method calls. We are
currently trying to add some code optimization phases to the Scala
compiler, so maybe you can soon use this technique and expect
efficient code.
Philippe
trait Numbers[T] {
def zero: T;
def one: T;
def cst(i: Int): T;
def add(x: T, y: T): T;
def sub(x: T, y: T): T;
def mul(x: T, y: T): T;
def div(x: T, y: T): T;
def eq(x: T, y: T): Boolean;
(Continue reading)
5 Jan 2005 13:26
Re: Freshmeat out of date
Michel Schinz <Michel.Schinz <at> epfl.ch>
2005-01-05 12:26:24 GMT
2005-01-05 12:26:24 GMT
Le 2 janv. 05, à 21:24, Cracl Pop a écrit : > "... Scala is listed on freshmeat where all new releases are > announced...." > > Freshmeat only has version 1.3.0.7 whereas it appears that 1.3.0.9 is > the latest? Yeah, the "all" is a bit misleading: there are a few very minor releases that are not announced there, 1.3.0.9 being one of them. I'll update the freshmeat page anyway, but this kind of situation will probably happen again in the future. Thanks, Michel.
9 Jan 2005 00:16
Scala combinators
Mike <mrivera <at> cs.ucr.edu>
2005-01-08 23:16:36 GMT
2005-01-08 23:16:36 GMT
Hi all, I've been very happily using the Scala combinators / for-comphrensions technique for my undergraduate at compilers class (I'm a student at UC Riverside). It's been extremely helpful and exciting for a simple guy like me to be introduced to the functional programming world like this - kudos to the team, and I'll be keeping up with page, -Mike
14 Jan 2005 10:01
.class equivalent in Scala
Oost, Arco <Arco.Oost <at> Getronics.com>
2005-01-14 09:01:28 GMT
2005-01-14 09:01:28 GMT
In Java I can use the suffix .class to use a class as a parameter to a method. In our applications we use this
both for our persistence layer and for setting up test suites in JUnit.
I haven't been able to find an equivalent in Scala. A work-around of course, is to use
Class.forName("some.ClassName"), but this has the disadvantage that it isn't checked by the compiler.
Is there something equivalent in Scala, or do I have to resort to the work-around.
Groeten,
Arco Oost
14 Jan 2005 10:15
Re: .class equivalent in Scala
Michel Schinz <Michel.Schinz <at> epfl.ch>
2005-01-14 09:15:50 GMT
2005-01-14 09:15:50 GMT
Le 14 janv. 05, à 10:01, Oost, Arco a écrit : > In Java I can use the suffix .class to use a class as a parameter to a > method. [...] > Is there something equivalent in Scala, or do I have to resort to the > work-around. Unfortunately, we don't have an equivalent notation in Scala right now, so you have to resort to the work-around you mention. Michel.
24 Jan 2005 17:18
dtd2scala limitations
Tobias Rademacher <toby-wan-kenobi <at> web.de>
2005-01-24 16:18:46 GMT
2005-01-24 16:18:46 GMT
Hi Folks, I am new to scala. Can you give me a hint to get th dtd2 scala tool to use a given package like: dtd2 -d generate-src bla.dtd blub bl.bla.blu Unfortunaly the generated blub source file does not have any package declaration! Is is a limitation of the dtd2scala tool. Thx a lot Toby -- -- Visit my Weblog <at> http://www.jroller.com/page/tradem
25 Jan 2005 09:19
Re: dtd2scala limitations
Burak Emir <Burak.Emir <at> epfl.ch>
2005-01-25 08:19:43 GMT
2005-01-25 08:19:43 GMT
Hello Toby-Wan, it is indeed a limitation of dtd2scala. I will try to add that feature for the next release. The syntax you suggested seems perfect. The "namespace" parameter denotes rather an XML namespace than a scala package. However, the object name could be prefixed with a path, e.g. "dtd2scala -d dir bla.dtd. bl.bla.blu.blub" would generate a source file "blub.scala" which defines an object "blub" in package "bl.bla.blu". This file would be in subdirectory "./bl/bla/bu" of "dir". I added this as feature request, you can find it and follow up on it in the bugtracking system #394. Thanks! cheers, Burak Tobias Rademacher wrote: >Hi Folks, > >I am new to scala. > >Can you give me a hint to get th dtd2 scala tool to use a given package like: > >dtd2 -d generate-src bla.dtd blub bl.bla.blu(Continue reading)
RSS Feed