Problem with abstract method

BlitzMax Forums/BlitzMax Beginners Area/Problem with abstract method

patmaba(Posted 2006) [#1]
Hi,

i have a small problem with my abstract method.

i receive the following error messages during compilation.

Compile Error: Syntax error in user defined type declaration
Build Error: failed to compile D:/BLIde for BlitzMax/MyProjects/Tachyon Storm/XmlLabo/TestXML.bmx



here the code

Type TAction
	Method Do(p_oCurrent:ObjectIA ) abstract  
	EndMethod
End Type

Type TActionArrive Extends TAction
	Field m_oTarget:ObjectIA
	Field m_dDeceleration:Double = 1	
	Field m_dDecelerationTweaker:Double = 100.0
	
	Function Create:TActionArrive( p_bTarget:ObjectIA, p_dDeceleration:Double = 1.0, p_dDecelerationTweaker:Double = 100.0 )
		Local l_AA:TActionArrive = New TActionArrive
		l_AA.m_oTarget = p_bTarget
		l_AA.m_dDeceleration = p_dDeceleration
		l_AA.m_dDecelerationTweaker = p_dDecelerationTweaker
		Return l_AA
	EndFunction 
	
	Method Do( p_oCurrent:ObjectIA )
		p_oCurrent.Arrive( Self.m_oTarget, Self.m_dDeceleration, Self.m_dDecelerationTweaker )
	EndMethod
End Type


the focus of the compil editor still on this positionEnd type of TAction

where is my syntax error ?

help me please

thanks


Tiger(Posted 2006) [#2]
try if it helps to remove the EndMethod in the Abstract method in TAction.


Gabriel(Posted 2006) [#3]
Yep, the EndMethod in TAction is the problem. BlitzMax does not expect you to use EndMethod with an abstract method.


patmaba(Posted 2006) [#4]
thank you very much.

it work fine


H&K(Posted 2006) [#5]
Hmmmm, I can see why you dont need an endMethod for abstract types, but on the other hand I can see how you might intuitivly add them.

Would it be a great problem for the compiler to deal with both? Or would this mess with those IDEs that fold.


Dreamora(Posted 2006) [#6]
Actually all IDE that fold tend to be broken and always add EndMethod to abstract methods for some reason.

And you mean for abstract methods I assume?
Because for types, end type is always needed to work.

The reason for no end method on abstract is simple (and anything else would be conter intiutive): There is nothing within the method so why should it define a code block and not only a header. With a block people might try to do stuff there.


H&K(Posted 2006) [#7]
Yep, I ment to methods. As to it being counter intuitive, surly that would be if you had to use endmethod? As long as its only you could, then most would not use it


Gabriel(Posted 2006) [#8]
Intuitive vs Counter-Intutive? I'm not sure. I did what Patmaba did when I first created abstract methods. I'd say it was 50/50. You might expect to do it or you might not.

With regard to IDE's, Blide does not add EndMethod for abstract types. Another good reason to use Blide?


Dreamora(Posted 2006) [#9]
Yes but the possibility to have an End Method on abstract methods would somehow imply that there is a use for the method block which is not the case.
Thats what I meant as counter intuitive.