Is "new" removed from AHK2? Topic is solved

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
madsounds
Posts: 59
Joined: 31 May 2019, 08:14

Is "new" removed from AHK2?

31 May 2020, 11:01

I've just launched this code on AHK2

Code: Select all

class MyClass
{
	__New( important_variable )
	{
		this.important_variable := important_variable
	}
}
myobj := new MyClass( 'test' )
MsgBox myobj.important_variable
And it says, "Call to nonexisting function", on the line myobj := new MyClass( 'test' ).

So is "new" really removed form AHK2 and I should call MyClass.New() instead?
madsounds
Posts: 59
Joined: 31 May 2019, 08:14

Re: Is "new" removed from AHK2?

31 May 2020, 11:19

Okay... Maybe somebody knows why? :D
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Is "new" removed from AHK2?

31 May 2020, 11:54

  • redundant
  • simplifies parsing
  • couldnt be used with shorthand syntax functions
lexikos
Posts: 9690
Joined: 30 Sep 2013, 04:07
Contact:

Re: Is "new" removed from AHK2?

01 Jun 2020, 22:37

I outlined some reasons in Class.md.

Return to “Ask for Help (v2)”

Who is online

Users browsing this forum: Marium0505 and 49 guests