Uhm.. What just happened?

BlitzMax Forums/BlitzMax Programming/Uhm.. What just happened?

SuperStrict

Framework brl.blitz

Import brl.standardio


Type TA
	'Method ToString:String()
	'	Return("TA")
	'End Method
End Type
Type TB
	Method ToString:String()
		Return("TB")
	End Method
End Type


Try
	
	Try
		
		Throw(New(TB))
		
	Catch e:TB
		
		Print("#2 " + e.ToString())
		Throw(New(TA))
		
	End Try
	
Catch e:TB
	
	Print("#1 " + e.ToString())
	
End Try


EDIT: It seems like the first Try..Catch block does not distinguish between TA and TB.
I've been having problems recently with nested Try blocks..

See the drastic changes when you do this:
SuperStrict

Framework brl.blitz

Import brl.standardio
Import brl.linkedlist

Type TA
	'Method ToString:String()
	'	Return("TA")
	'End Method
End Type
Type TB
	Method ToString:String()
		Return("TB")
	End Method
End Type

Local mylist:TList = New(TList)
mylist.AddLast(New(TB))
mylist.AddLast(New(TA))
mylist.AddLast(New(TB))
mylist.AddLast(New(TA))
mylist.AddLast(New(TA))
mylist.AddLast(New(TB))
mylist.AddLast(New(TA))
mylist.AddLast(New(TB))
mylist.AddLast(New(TB))

For Local lobj:TB = EachIn mylist
	
	Try
		
		Try
			
			Throw(lobj)
			
		Catch e:TB
			
			Print("#2 " + e.ToString())
			Throw(New(TA))
			
		End Try
		
	Catch e:TB
		
		Print("#1 " + e.ToString())
		
	End Try
	
Next


My code is working fine now.. but that doesn't mean this isn't doing something wacky.

NOTE: Make sure you're ABSOLUTELY CERTAIN you aren't throwing Null ;)