Accessor - hpgDesigns/hpgdesigns-dev.io GitHub Wiki
In programming in general, an accessor is a function designed exclusively to return a variable it represents. While seeming pointless, accessors are a key part of many programs, including ENIGMA.
In C++, accessors are most often used to return the values of private
members. This is often done to standardize and unify classes which are
required to offer access to a certain attribute, but are not required to
use a specific implementation. For example, string
offers a
length() accessor. In some implementations, this function simply returns
this
->
size
. In the GNU implementation, it returns
((size_t*)data)[-2]
. In a really shitty implementation, it may return
strlen
(
data
)
.
In ENIGMA, accessors are used mostly for cross-scope access routines; namely, dot access. Accessors are generated and called automatically by the ENIGMA compiler in order to get more complicated games to run.