- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
x > y gives error..
Thu, 2009-03-12, 10:58
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
Thu, 2009-03-12, 12:37
#2
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
Thu, 2009-03-12, 12:57
#3
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:
--
-Tako
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
Thu, 2009-03-12, 13:07
#4
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
Thu, 2009-03-12, 13:17
#5
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
Thu, 2009-03-12, 13:57
#6
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.
Thu, 2009-03-12, 14:17
#7
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
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.