[Solved] What's wrong with this NG Type?

BlitzMax Forums/BlitzMax NG/[Solved] What's wrong with this NG Type?

RustyKristi(Posted 2016) [#1]
One of my type needs to create a type inside it and I'm getting a Node to Int unable to convert error

Type Node
	
	Field up
	Field down
	Field X:Int
	Field Y:Int

	Method Create:Node(x:Int,y:Int)
		Local n:Node = New Node
		n.X=x
		n.Y=y	
		Return n
	End Method

	Method Draw(x:Int,y:Int)
	
		up = New Node.Create(x,y)

	End Method	
	
End Type	



col(Posted 2016) [#2]
Type Node
	
	Field up:Node		' <----- here
	Field down
	Field X:Int
	Field Y:Int

	Method Create:Node(x:Int,y:Int)
		Local n:Node = New Node
		n.X=x
		n.Y=y	
		Return n
	End Method

	Method Draw(x:Int,y:Int)
	
		up = New Node.Create(x,y)

	End Method	
	
End Type



RustyKristi(Posted 2016) [#3]
thanks Dave, sometimes I'm really forgetting those details. works ok now!


Derron(Posted 2016) [#4]
SuperStrict really helps here :-)


RustyKristi(Posted 2016) [#5]
Yes I know Derron, but in my case here I'm doing a conversion from Monkey and I can't deal with superstrict checking atm.

Maybe I'll try this next time :)


Derron(Posted 2016) [#6]
I can't deal with superstrict checking atm.

But you shouldn't bother others with issues then, which would "cure on its own", when done with SuperStrict ;-)


Lazyness now is just delaying the workload for a later moment. Just do now properly and save time later on.

Another benefit is: you now have higher chances to already find bugs because of wrong data types (field b:byte = integervalue).


bye
Ron


RustyKristi(Posted 2016) [#7]
Lazyness now is just delaying the workload for a later moment. Just do now properly and save time later on.


Problem with that is, that's not my work to begin with and it's from a Mojo2 conversion, which does not exist in Blitzmax until Brucey made the port. I'm trying to convert as close as I can without knowing or having any experience with mojo and mojo2 before.

If I were to do it on my own from scratch, that would certainly not be the case. ;-)

In the end, we all make small mistakes or miss something every now and then, even if we impose this type of strictness method, and we're not just talking about typos that makes into commits.. ;-)