Geoff Reedy | 5 Feb 19:16
Gravatar

Re: [scala-language] Units of Measurement — Scala Macros to the rescue?

On Feb 5, 2012, at 10:45 AM, Miles Sabin wrote:
> What Rex is saying (quite reasonably IMO) is that whatever the X in
> "equality wrt to X" it should at least be an equivalence relation, ie.
> reflexive, symmetric and transitive.

Shouldn't === use the equivalence relation for the LUB of the argument types.

Given

a: A
b: B
C <: A
C <: B
D <: C

with

eqD being the equivalence relation wrt D
eqC being the equivalence relation wrt C

then you should have

eqD ⊆ eqC

which gives

eqD(a,b) => eqC(a,b)

all by the substitutability principle.
(Continue reading)

[scala-language] Units of Measurement — Scala Macros to the rescue?

Hi everyone,

as some people know, I have been working on the Units of Measurement functionality of metascala, where a unit is represented by a numerical value for quantity and 7 generic types representing the SI units.

The last two major things missing in my book are implementations of toString, equals and probably hashCode. They are currently not really implementable, because they depend on the generic types which are not available at runtime.

Would macros enable me to implement these operations by looking at them at compile time? E.g. implementing equals by checking that the two compared instances have the same generic types with a macro and refusing to compile if they don't?

Thanks and bye,


Simon

sterg | 3 Feb 15:49
Picon
Gravatar

classpath setByUser in Scala 2.10

Hi all,

finally I ported ScalaLab to Scala 2.10.

The reason behind the "object Scala not found"
message that I took before,
is the new
  "setByUser" flag
that defaults to false and requires to set it to set to true,
in order to enable configuration of the classpath of the compiler in
2.10.

It seems to me somewhat tricky to find it !!

Best Regards

Stergios

Gravatar

Re: Re: Re: Re: Re:

Hello
I have Order china dear friend:
I have Order china 6 Apple MacBook Pro MB991LL / A 13.3
w e b: bodysa.com
I've received the item today
I believe you will find what you want there and have an good experience
on shopping from them.
Regards!
Simon Ochsenreither | 27 Jan 11:45

InfoQ talk about Type Providers in F# 3.0

Hi everyone,

for those who haven't seen it yet, there is a great recording about F# Type Providers from Strange Loop up on InfoQ:
http://www.infoq.com/presentations/The-Future-of-FSharp-Type-Providers

It's a great source of inspiration for Scala and probably _the_ standard to which the future Scala database stuff has to be compared.

Bye,

Simon


Ka Ter | 26 Jan 17:52
Gravatar

Type classes and implicits

Hi all,

I'm playing with type classes and implicits and don't understand why
both of the println lines below produce the compiler error:

could not find implicit value for evidence parameter of type
GenericBased[scala.collection.immutable.Set]

I surely understand the message but I don't understand why the mentioned
type could not be found. Why can't the compiler relate a Set with a
Traversable? Any thoughts?

(I need the GenericBasedWrapper only, as Scala doesn't support some kind
of implicit infix functions).

My code:
=========
import scala.collection.parallel.ParIterable

object Test extends App
{
    implicit val traversableBased = TraversableBased
    implicit val parallelBased = ParallelBased

    implicit def toGenericBasedWrapper[A, C[A] : GenericBased](source:
C[A]): GenericBasedWrapper[A, C] = new GenericBasedWrapper[A, C](source)

    println(Set[Int](1, 2, 3).doSomething((set: Set[Int]) => set.map(a
=> a + 1)))
    println(Set[Int](1, 2, 3).doSomething(set => set.map(a => a + 1)))
}

class GenericBased[+C[_]]
{
    def doSomething[A](source: C[A], f: C[A] => C[A]): C[A] = f(source)
}

class GenericBasedWrapper[A, +C[_]: GenericBased](source: C[A])
{
    def doSomething(f: C[A] => C[A]): C[A] =
implicitly[GenericBased[C]].doSomething[A](source, f)
}

object TraversableBased extends GenericBased[Traversable]
object ParallelBased extends GenericBased[ParIterable]

--

-- 
Best Regards

Ka Ter

Picon
Gravatar

usejavacp = true with Scala 2.10

Hi all,

I have a problem porting ScalaLab with Scala 2.10: 

when I use in Settings the  usejavacp = true
it works within Netbeans correctly,
but when I run the executable standalone,
it outputs the error: "object scala not found"

In Scala 2.8 and Scala 2.9 the same code runs without problem,
without setting usejavacp=true

Can somebody identify what happens?

Regards
Stergios

Simon Ochsenreither | 24 Jan 01:04

Regression in Scala 2.10 concerning self types

Hi,

I have the following code, which stopped compiling with the current trunk 2.10, but worked with 2.9.1:

  trait TFn1B {
   
type In
   
type Out
   
type Apply[T <: In] <: Out
 
}

 
trait TFn1[I, O] extends TFn1B {
   
type In = I
   
type Out = O
 
}

 
trait >>[F1 <: TFn1[_, _], F2 <: TFn1[_, _]] extends TFn1[F1#In, F2#Out] {
   
type Apply[T] = F2#Apply[F1#Apply[T]]
 
}

In 2.10 the compiler complains:

Fun.scala:12: error: illegal inheritance;
 self
-type this.>>[F1,F2] does not conform to this.TFn1[_$1,_$4]'s selftype this.TFn1[_$1,_$4]
 
trait >>[F1 <: TFn1[_, _], F2 <: TFn1[_, _]] extends TFn1[F1#In, F2#Out] {
                                                       
^
one error found

Should I file a bug or is this expected?

Thanks and bye,

Simon

daniel.kminek | 22 Jan 10:49
Picon
Favicon
Gravatar

java.lang.NoClassDefFoundError scala on JVM

Hallo I am desperate :-(

Someone please help me ?
I start with scala and hello world.

My goal is to run the program scala on the JVM

 

Still have error "Noclassdeffounderror: HelloWorld".

for this easy program


object HelloWorld {
    def main(args: Array[String]) {
      println("Hello, world!")
    }
  }

 

scala HelloWorld run OK

 

But  return error for

 

C:\Users\oem\IdeaProjects\untitled7\src>java -cp scala-library.jar HelloWorld
Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld
Caused by: java.lang.ClassNotFoundException: HelloWorld
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: HelloWorld.  Program will exit.

 

I have scala-library.jar in the same directory

What is the proper methods to run scala on the JVM? I tried many methods without success

Thank you

 

Miller Heather | 21 Jan 17:02
Picon
Picon
Favicon
Gravatar

Reorganization of SIPs site, please update your forks

Hi all, 

(cross-posted from scala-sips)

We've done a bit of reorganizing on the SIPs site. The content and URLs are all exactly the same, but any
existing forks of the repo need to be updated to use: http://github.com/scala/scala.github.com.

Cheers, 
Heather
Scala Mailing Lists | 21 Jan 15:32
Picon
Picon
Favicon
Gravatar

Mailing list reminder: Scala-language

Welcome to the "Scala-language" mailing list.

This automatic reminder is sent once a month to the list,
to keep subscribers up-to-date with the mailing list services,
and to help keeping the list on topic.

-------------------------------------------------------------------

The "Scala-language" mailing list:

This list is the main forum for discussions and news about the
Scala language. Questions about programming in Scala, especially
by beginners, should preferably go to the "scala-user" list
instead: please post there if you would like to discuss your
code snippets or need assistance. Questions about Scala tools
should go to "scala-tools".

Questions about the Scala IDE for Eclipse should go to 
http://groups.google.com/group/scala-ide-user.

Threads that become too long, and are unlikely to be of general
interest, should eventually be moved to "scala-debate".

-------------------------------------------------------------------

Other information:

There are several Scala lists devoted to individual topics (and
more may be created in the future). For the full list, please
see: http://www.scala-lang.org/node/199

Try to avoid cross-posting whenever possible. If you can, select
the list that is closer to your topic and post in that list only.
In any case, never cross-post replies.

If you ever want to unsubscribe from this list, just visit this
page: http://groups.google.com/group/scala-language/subscribe
or send an email to scala-language+unsubscribe <at> googlegroups.com

Thank you!
The Scala Team


Gmane