Throwing in Delete

BlitzMax Forums/BlitzMax Programming/Throwing in Delete

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

(Sorry if it has already been mentioned, but the search feature is currently unavailable).

Throwing from the Delete method causes memory leaks. Actually I was expecting this as throwing in a destructor is a no no in C++. But I was hoping BlitzMax to be able to cope with it given the simpler memory model, and above all the fact that memory is reclaimed in a separate phase, when calling FlushMem.
Anyway, it doesn't appear so.
I'm also a bit surprised because when it was asked if BlitzMax was going to have destructors, skidracer mentioned the fact that allowing destructors would bring the potential problem of having an exception thrown during the garbage collection. Now we finally have destructors, so what's the official position regarding throwing in the Delete method?

Framework brl.blitz
Type MyType
	Method Delete()
		RuntimeError("Delete")
	End Method
End Type

Repeat
	Try
		FlushMem
		Local obj:MyType = New MyType
	Catch ex:TRuntimeException
	End Try
Forever


I still think handling this - without simply saying throwing in the Delete method is evil - is possible, but that's just a guess.