'new'ing variables causes EAV

Archives Forums/BlitzMax Bug Reports/'new'ing variables causes EAV

col(Posted 2012) [#1]
I know you shouldn't be newing variables, but the compiler should pick this up no?

Type TType
EndType

'Local TType:TType	'Compiler correctly catches this isn't a variable

Local myType:TType
myType = New myType 'EAV here - compiler doesn't catch that myType  is a variable and not a Type!


Last edited 2012


TomToad(Posted 2012) [#2]

It is possible to create an instance of a type using another instance. I can't remember the reasoning behind this, maybe something to do with reflection? The reason that your code is giving a EAV is because you had not yet created an instance before using New.


col(Posted 2012) [#3]
Thankyou,

I understand it, however I don't ever recall seeing that method of creating an instance. Are there any 'real use' examples to take advantage of this?