cannot use int.maxValue
Posted: Thu Jan 15, 2009 10:08 am
Or uint.minValue, or any other property of that kind. I can easily find a work around, so this is not an urgent thing.
Discussion about the Cobra programming language.
http://cobra-language.com/forums/
class Program
def isPositive(x as dynamic) as bool is shared
return x > 0
def main is shared
print .isPositive(3f)
extend String
def func1
pass
extend String
def func2
pass
class Program
def main is shared
pass
(a to IComparable).compareTo(b)
class G<of T>
var myT as T
class Program
var g = G<of int?>()
def main is shared
p = Program()
Chuck wrote:I've enhanced the code to promote the integer when needed and checked in the fix.
def isPositive(x as dynamic) as bool is shared
zero = 0 to x.type
return x > zero
jonathandavid wrote:I think I found another bug:class G<of T>
var myT as T
class Program
var g = G<of int?>()
def main is shared
p = Program()
This triggers a runtime assertion, complaining that myT is nil. It is as if the compiler did not realize that T is taking the value int?, and that therefore "myT" should be allowed to be nil.
jonathandavid wrote:Chuck wrote:I've enhanced the code to promote the integer when needed and checked in the fix.
Thanks. Is there another way to obtain a zero converted to the type of "x"?
I'm thinking of something along the lines of:def isPositive(x as dynamic) as bool is shared
zero = 0 to x.type
return x > zero
Convert.changeType(0, x.getType)
def foo(a, b) ...
Chuck wrote:Looks like a bug. Can you add a ticket?