[Gambas-user] static ? in variables

Tobias Boege taboege at ...626...
Thu Jun 15 21:02:05 CEST 2017


On Thu, 15 Jun 2017, PICCORO McKAY Lenz wrote:
> hi tobias, *the documentation are totally wrong.. due the documentation
> makes a explicit citation to the concep in wikipedia*,that's why i ask so
> many about it
> 
> now i propose to change by myselft that documentation to a proper paragraph
> that translators can understand without transliterate the meaning..
> 
> and in any case thanks to your explication now i can understand the right
> usage..
> 
> with this specific problem i can point the importance of a documentation,
> i'll practice some all of your said and then try to correct better the wiki
> doc
> 

Well, I read the wiki page again after you pointed this out and, technically
speaking, the wiki is correct:

  This feature allows you to implement the object-oriented programming singleton pattern.

Indeed CREATE STATIC allows you to implement the familiar singleton pattern,
but CREATE STATIC *alone* does not suffice. To get the singleton you have to
use

  CREATE STATIC
  CREATE PRIVATE

together (CREATE PRIVATE is linked on the CREATE STATIC page and it
disallows the creation of objects of a class, except for the automatic
instance, because the interpreter can and will bypass the CREATE PRIVATE
limit to fulfill the CREATE STATIC flag).

Maybe this is all that's needed for the clarification. If you agree that
CREATE STATIC + CREATE PRIVATE = singleton pattern, then I can change
the wiki page, with slightly better English I believe.

Regards,
Tobi

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk




More information about the User mailing list