TIP: Singleton with Autohotkey

Put simple Tips and Tricks that are not entire Tutorials in this forum
User avatar
hoppfrosch
Posts: 443
Joined: 07 Oct 2013, 04:05
Location: Rhine-Maine-Area, Hesse, Germany
Contact:

TIP: Singleton with Autohotkey

Post by hoppfrosch » 25 Nov 2016, 01:03

Hi everybody,

I just searched for a Singleton implementation with AutoHotkey and I found the following: http://www.programering.com/a/MDN4YDMwATU.html
It's quite simple, so I thought I share my finding.

Basically spoken, a Singleton is a design pattern which ensures that a class has only one instance. Most common use for a Singleton (at least for me) is as a replacement for global variables. If you want to know more about Singletons have a look at Wikipedia(or google for it).

Here's the implementation suggestion for a Singleton with AutoHotkey - All credits go to: http://www.programering.com/a/MDN4YDMwATU.html

lexikos
Posts: 9688
Joined: 30 Sep 2013, 04:07
Contact:

Re: TIP: Singleton with Autohotkey

Post by lexikos » 25 Nov 2016, 03:31

Why don't you just use the class itself? There is no need to instantiate it or to check if it has already been instantiated, because it always exists.

Post Reply

Return to “Tips and Tricks (v1)”