Probably bad coding form but...
LOCAL a AS P = P.Create( x, y )
Removing the "= P.Create( x, y )", seems to fix it.
*EDIT* spoke too soon,
the
= P.Create( x, y )
causes the error.
Even this does not work...
LOCAL a AS P
a = P.Create( x, y )
OK, here's a rough type to explain the above a bit more...
TYPE P
x#
y#
FUNCTION Create AS P: x#, y#
LOCAL ap AS Point
ap.x=x
ap.y=y
RETURN ap
ENDFUNCTION
ENDTYPE
*EDIT 2*
Its OK, this works...
LOCAL a AS P
a = a.Create( x, y )
Which kinda makes sense, my original line compiled on the previous compiler version, so I stuck with it.
That all being said, I would like to still use the syntax of my first line. =D
Cheers,
Ian
I don't think GLBasic supports static types.
So, I think you need to declare an instance of the type before you call it's methods.
The type name itself can't be used to access the methods.
So, in theory, this should work:
LOCAL a AS P = a.Create(x, y)
But since 'a' isn't declared yet in 'a.Create(x, y)' it may not work either.
Maybe you could create a global 'static' instance for this kind of usage:
GLOBAL gP as P
...
LOCAL a AS P = gP.Create(x, y)
That's not a bad idea, I'll stick with the current solution but I'll use your method as a fallback if mine goes belly up.
Cheers,
Ian
It might be worth implementing, if only to make sure that there is no ambigious code when doing something like that.