Author Topic: floats in classes not working  (Read 4196 times)

0 Members and 1 Guest are viewing this topic.

kryton9

  • Guest
floats in classes not working
« on: May 07, 2011, 01:24:02 PM »
I was pulling my hair out and finally did this test and saw that there is a problem with floats in classes.
I will make one for all variable types to test next. But wanted to report this for now.

I commented out the floats code so it would compile and run.
So run first then uncomment out the float parts to see the error, thanks.

Code: [Select]
'Error when using floats

class v3
private
' x as float
y as double
z as long
public
'Setters
' method setx(v as float)
' this.x = v
' end method

method sety(v as double)
this.y = v
end method

method setz(v as long)
this.z = v
end method

'Getters
' method getx() as float
' method = this.x
' end method

method gety() as double
method = this.y
end method

method getz() as long
method = this.z
end method
end class


'Program Code
dim v as v3

'v.setx 42.24
v.sety 89.5
v.setz 7

'print `x: ` str v.getx
print `y: ` str v.gety
print `z: ` str v.getz


.

kryton9

  • Guest
test class commented out
« Reply #1 on: May 07, 2011, 02:18:46 PM »
Charles, I made a test class for testing all the variables in a class.
Here is the version that is mostly commented out.

This compiles fine but goes to la la land when run. Everything is in place for you to use this to test for further bugs.

.
« Last Edit: May 07, 2011, 03:09:06 PM by kryton9 »

Charles Pegge

  • Guest
Re: floats in classes not working
« Reply #2 on: May 07, 2011, 05:29:36 PM »

Hi Kent,

"float" was not recognised in the basic syntax. "Single" is okay.

I have now added "float" to the Basic primitives list so this will work in future releases.

Charles

Charles Pegge

  • Guest
Re: floats in classes not working
« Reply #3 on: May 07, 2011, 06:29:11 PM »

Kent,

Thanks for your testVars.

I'm going to dump all the underscory C types from keywords list. They can be soft coded whenever needed using Typedef.

I can then merge the remaining C types with the Basic types to ensure internal consistency.

Charles


kryton9

  • Guest
Re: floats in classes not working
« Reply #4 on: May 07, 2011, 08:48:37 PM »
Thanks Charles, it will be nice to know what we can and can't use and to not worry about the internal underscory things.

Peter

  • Guest
Re: floats in classes not working
« Reply #5 on: May 08, 2011, 04:03:17 AM »
Hi,

I see that we become more and more C! The naming shouldn't be OXYGENBASIC rather OXYGENBC.   :D
 

Charles Pegge

  • Guest
Re: floats in classes not working
« Reply #6 on: May 08, 2011, 04:19:55 AM »

I'm trying to leave out most of the C uglys and adopt the more elegant parts. I think the Basic language in general could benefit from some beauty treatment :)

Charles