Problems using Exit when using the new operator. Topic is solved

Report problems with documented functionality
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Problems using Exit when using the new operator.

12 May 2017, 17:52

[Note by Lexikos: Topic moved from Ask for Help to Bug Reports for future reference.]

I have problems when using Exit inside with the new operator.
I need help explaining what cause the different behaviours in the following examples.
First, the documention of Exit has this example

Code: Select all

#z::
Gosub, Sub2
MsgBox, This msgbox will never happen because of the EXIT.
return

Sub2:
Exit
Indeed, the msgbox is not shown. However, in these two examples, my expectation was that I wouldn't see either of the msgboxes, yet I get the #1 msgbox, but not the one from #2.

Code: Select all

#1::
	a:=new test
	MsgBox, This msgbox will happen despite the EXIT.
return

#2::
	b:=test.__new()
	MsgBox, This msgbox will never happen because of the EXIT
return
#3::MsgBox, % "a.a: "  a.a " b.a: " b.a
class test{
	a:="a"
	__new(){
		;throw exception("e")
		exit
	}
}
If you substitute the exit in __new() with throw exception(.), the error message says, The thread has exited., and indeed, no msgbox in either case. Also, I have read threads and searched for any mention of exit in the context of the new operator, I still do not understand.

Thank you for your time. Cheers.

Tested on win7, ahk unicode 64, 1.1.25.01.

Edit:
lexikos wrote:Fixed by v1.1.25.02.
Thank you. :thumbup:
Last edited by Helgef on 13 May 2017, 01:55, edited 2 times in total.
lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: Problems using Exit when using the new operator.

12 May 2017, 22:42

It's a bug. I'll fix it. (It was fixed in the v2 branch in 2014.)

Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 34 guests