duplicate indentifier, but there isn't one!

BlitzMax Forums/BlitzMax Programming/duplicate indentifier, but there isn't one!

skn3(Posted 2006) [#1]
The program gives the error "duplicate identifier"

Function test(value:Int = 5)
	If value = 5
		Local mylocal:Int = 12345
	Else
		Local mylocal:Int = 12345
	End If
End Function


Only 1 of the local declarations should ever be executed in 1 call of this function, so is this a bug ?


WendellM(Posted 2006) [#2]
It seems to work fine with a Strict or SuperStrict at the top. I remember reading something way back about Local acting slightly differently in non-Strict mode, but since I always use Strict, I don't recall the details.


marksibly(Posted 2006) [#3]
Locals in Non-Strict functions all have the same scope - the function they're declared in.


skn3(Posted 2006) [#4]
It would be good if there was some kind of documentation for this


Dreamora(Posted 2006) [#5]
Right
On the other side, there is no intelligent reason not to use at least strict to identify typing mistakes straight away. (one of the largest annoyances in Blitz3D after all :) )


skn3(Posted 2006) [#6]
Indeed, I use superstrict but it just so happened it was in an import which I was still working on and forgot to insert the "superstrict" at the top.