This page is no longer maintained — Please continue to the home page at www.scala-lang.org

x > y gives error..

7 replies
Michael Wohlwend
Joined: 2009-03-12,
User offline. Last seen 3 years 29 weeks ago.

just while trying some stupid examples and not seeing the error:

in the console (2.7.3 final):

scala> 5 > 3
res6: Boolean = true

and
scala> "j" < "ii"
res4: Boolean = false

o.k, so now:
def moin(s:String, r:String) = {
s < r
}

scala> moin ("j", "oo")
res5: Boolean = true

and now:
scala> def moin2(s:Int, r:Int) = {
s > r
}
:5: error: value > is not a member of Int
s > r
^

?????
where is my stupid error / misunderstanding? :-)

cheers
Michael

Florian Hars
Joined: 2008-12-18,
User offline. Last seen 42 years 45 weeks ago.
Re: x > y gives error..

Michael Wohlwend schrieb:
> and now:
> scala> def moin2(s:Int, r:Int) = {
> s > r
> }
> :5: error: value > is not a member of Int
> s > r
> ^

scala> def moin2(s:Int, r:Int) = {
| s > r
| }
moin2: (Int,Int)Boolean

> where is my stupid error / misunderstanding? :-)

Redefining Int somewhere?

- Florian.

Michael Wohlwend
Joined: 2009-03-12,
User offline. Last seen 3 years 29 weeks ago.
Re: x > y gives error..

Am Thursday 12 March 2009 12:07:49 schrieben Sie:
>
> Redefining Int somewhere?

no, just after starting the console:

Welcome to Scala version 2.7.3.final (OpenJDK 64-Bit Server VM, Java 1.6.0_0).
Type in expressions to have them evaluated.
Type :help for more information.

scala> def moin2(s:Int, r:Int) = {
| s > r
| }
:5: error: value > is not a member of Int
s > r
^

scala>

Michael

Tako Schotanus
Joined: 2008-12-22,
User offline. Last seen 42 years 45 weeks ago.
Re: x > y gives error..
Well it works here too:

Welcome to Scala version 2.7.2.final (Java HotSpot(TM) Client VM, Java 1.6.0_11)
.
Type in expressions to have them evaluated.
Type :help for more information.

scala> def moin2(s:Int, r:Int) = {
     |      s > r
     |      }
moin2: (Int,Int)Boolean

scala> moin2(5,6)
res1: Boolean = false


On Thu, Mar 12, 2009 at 12:19, Michael <micha-1@fantasymail.de> wrote:
Am Thursday 12 March 2009 12:07:49 schrieben Sie:
>
> Redefining Int somewhere?

no, just after starting the console:

Welcome to Scala version 2.7.3.final (OpenJDK 64-Bit Server VM, Java 1.6.0_0).
Type in expressions to have them evaluated.
Type :help for more information.

scala> def moin2(s:Int, r:Int) = {
    | s > r
    | }
<console>:5: error: value > is not a member of Int
      s > r
        ^

scala>


 Michael



--

-Tako
Florian Hars
Joined: 2008-12-18,
User offline. Last seen 42 years 45 weeks ago.
Re: x > y gives error..

Michael schrieb:
> Am Thursday 12 March 2009 12:07:49 schrieben Sie:
>> Redefining Int somewhere?
> no, just after starting the console:

Weird. Looks like a broken installation.
Some obsolete scala-library.jar somewhere in the classpath?
Strange compiler plugins $SCALA_HOME/misc/scala-devel/plugins ?
Installed during the wrong phase of the moon?

- Florian

Michael Wohlwend
Joined: 2009-03-12,
User offline. Last seen 3 years 29 weeks ago.
Re: x > y gives error..

Am Thursday 12 March 2009 12:56:19 schrieb Florian Hars:
> Weird. Looks like a broken installation.

I first used the installer jar file. Now I tried wih the tgz in a new
directory and get the same effect.
No idea what's going wrong here.
Are vm args to trace the calls ?

> Some obsolete scala-library.jar somewhere in the classpath?

no

> Strange compiler plugins $SCALA_HOME/misc/scala-devel/plugins ?

don't think so, since there is no scala-devel

> Installed during the wrong phase of the moon?

the last hope :-)

my java version is:

OpenJDK Runtime Environment (build 1.6.0_0-b11)
OpenJDK 64-Bit Server VM (build 1.6.0_0-b11, mixed mode)

Michael

Florian Hars
Joined: 2008-12-18,
User offline. Last seen 42 years 45 weeks ago.
Re: x > y gives error..

Michael schrieb:
> Am Thursday 12 March 2009 12:56:19 schrieb Florian Hars:
>> Installed during the wrong phase of the moon?
>
> the last hope :-)
>
> my java version is:
>
> OpenJDK Runtime Environment (build 1.6.0_0-b11)
> OpenJDK 64-Bit Server VM (build 1.6.0_0-b11, mixed mode)

Works here. I still think you have a funny class Int in your classpath,
what do you get there:

scala> classOf[Int]
res1: java.lang.Class[Int] = int

- Florian.

Michael Wohlwend
Joined: 2009-03-12,
User offline. Last seen 3 years 29 weeks ago.
Re: x > y gives error..

Am Thursday 12 March 2009 13:49:58 schrieb Florian Hars:
>
> Works here. I still think you have a funny class Int in your classpath,
> what do you get there:

hmmm, yep, there is ( now: *was*) an Int.class file laying around in my home
which caused this mess. I never got this failure before, since I normaly
work in a different dircetory and also I looked at the contents of my home
dir I didn't see it first *grrrr*

Overriding is a feature :-)

Michael

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland