static ? in variables

classic Classic list List threaded Threaded
16 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

static ? in variables

PICCORO McKAY Lenz
"This keyword is used for declaring static variables, static methods and
singleton classes."

About singleton clases, that mean guarantee a unique instance of.. but if
the class are not static and have one variable static, what that's means?

Lenz McKAY Gerardo (PICCORO)
http://qgqlochekone.blogspot.com
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: static ? in variables

Tobias Boege-2
On Thu, 15 Jun 2017, PICCORO McKAY Lenz wrote:
> "This keyword is used for declaring static variables, static methods and
> singleton classes."
>
> About singleton clases, that mean guarantee a unique instance of..
>

No, the word "singleton" here just means you get an automatic instance of
your class, i.e. you can use the class name as if it were an object. You
do *not* get a unique instance. You have to use the CREATE PRIVATE keyword
for non-instantiable classes.

> but if
> the class are not static and have one variable static, what that's means?
>

Nothing extraordinary happens. You have a dynamic class with a static
variable and you can use the class like an object (as well as create new
objects of that class).

Regards,
Tobi

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

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: static ? in variables

PICCORO McKAY Lenz
thanks in advance, but i have now more questions:
2017-06-15 8:41 GMT-04:00 Tobias Boege <[hidden email]>:

> No, the word "singleton" here just means you get an automatic instance of
> your class, i.e. you can use the class name as if it were an object. You
>
automatic instance?

maybe its a translation problem, but i try to understant: wiki said here:
http://gambaswiki.org/wiki/lang/createstatic
in a tip:
"allows you to implement the object-oriented programming singleton pattern
<http://en.wikipedia.org/wiki/Singleton_pattern>."
and i understand by singleton pattern that a only one instance du i was a
J2EE programer:
"restricts the instantiation
<https://en.wikipedia.org/wiki/Instantiation_%28computer_science%29> of a
class <https://en.wikipedia.org/wiki/Class_%28computer_programming%29> to
one object <https://en.wikipedia.org/wiki/Object_%28computer_science%29>.
This is useful when exactly one object is needed to coordinate actions
across the system"

so here are some things that i cannot understant and i think its something
with translation or?


> Nothing extraordinary happens. You have a dynamic class with a static
> variable and you can use the class like an object (as well as create new
> objects of that class).
>
for the variable:

public statis var as string

vs

public var as strings

doc wiki said "will be shared with all the class" seems that there's no
diference based on your answer


>
> Regards,
> Tobi
>
> --
> "There's an old saying: Don't change anything... ever!" -- Mr. Monk
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Gambas-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: static ? in variables

Tobias Boege-2
On Thu, 15 Jun 2017, PICCORO McKAY Lenz wrote:

> thanks in advance, but i have now more questions:
> 2017-06-15 8:41 GMT-04:00 Tobias Boege <[hidden email]>:
>
> > No, the word "singleton" here just means you get an automatic instance of
> > your class, i.e. you can use the class name as if it were an object. You
> >
> automatic instance?
>
> maybe its a translation problem, but i try to understant: wiki said here:
> http://gambaswiki.org/wiki/lang/createstatic
> in a tip:
> "allows you to implement the object-oriented programming singleton pattern
> <http://en.wikipedia.org/wiki/Singleton_pattern>."
> and i understand by singleton pattern that a only one instance du i was a
> J2EE programer:
> "restricts the instantiation
> <https://en.wikipedia.org/wiki/Instantiation_%28computer_science%29> of a
> class <https://en.wikipedia.org/wiki/Class_%28computer_programming%29> to
> one object <https://en.wikipedia.org/wiki/Object_%28computer_science%29>.
> This is useful when exactly one object is needed to coordinate actions
> across the system"
>
> so here are some things that i cannot understant and i think its something
> with translation or?
>

It's not a translation error, it is that "singleton" has a different meaning
in the paragraph you cite than it has in Gambas. Actually, the documentation
should probably avoid the word "singleton", because it creates confusion with
a more established notion of "singleton" (the one you cite).

Now, let me tell you again what the documentation means when it says
"singleton". When you put the CREATE STATIC keyword into the top of your
class, then the class will be made "auto-creatable". This means that if
your Gambas program uses the class name like an object, e.g. by accessing
a non-static property or method over the *class* name (which doesn't make
sense), then the interpreter will create an object out of this class
(the so-called automatic instance -- because the interpreter creates it
automatically for you in the background as soon as you need it) and uses
this object in place of the class name.

CREATE STATIC does *not* ensure that you can create *only* one instance
of the class. This is not what "singleton" means in Gambas. You can create
multiple objects out of a CREATE STATIC class.

There are two famous examples of auto-creatable (CREATE STATIC) classes,
which I can think of off the top of my head:

  (1) Settings (gb.settings), if you ever worked with it, is a class of
      which you can create as many objects as you like, right? But you can
      also use the class name "Settings" as if it were an object, e.g.

        Print Settings["Key"]

      Here it looks you access a key "Key" of the class Settings, but this
      doesn't make sense as the array accessors aren't static methods of the
      Settings class. In fact, Settings, in this case, behaves as if you
      created as Settings object behind the scenes which is linked to the
      default configuration file path $XDG_CONFIG_HOME &/ Application.Name & ".conf".
      This is precisely the automatic instance of the Settings class.

  (2) An even more prominent example: every Form class is auto-creatable.
      Have you ever wondered why, if you start your GUI project with startup
      form "FMain", a window pops up? You only have a Form class but you
      never created an object of this Form class, so where does this window
      come from? This also is the automatic instance of your class FMain,
      showing itself on startup. You can also write

        FMain.Center()

      to center your main window on the screen. The class name "FMain"
      does not refer to the class, but to the automatic instance, an
      *object* of class FMain that the interpreter created and that is
      used behind the scenes.

This is the "singleton" behaviour that the documentation describes.

>
> > Nothing extraordinary happens. You have a dynamic class with a static
> > variable and you can use the class like an object (as well as create new
> > objects of that class).
> >
> for the variable:
>
> public statis var as string
>
> vs
>
> public var as strings
>
> doc wiki said "will be shared with all the class" seems that there's no
> diference based on your answer
>
>

I don't understand your objection at all. Maybe the above explanation clears
things up for you?

Regards,
Tobi

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

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: static ? in variables

PICCORO McKAY Lenz
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

Lenz McKAY Gerardo (PICCORO)
http://qgqlochekone.blogspot.com

2017-06-15 13:48 GMT-04:00 Tobias Boege <[hidden email]>:

> On Thu, 15 Jun 2017, PICCORO McKAY Lenz wrote:
> > thanks in advance, but i have now more questions:
> > 2017-06-15 8:41 GMT-04:00 Tobias Boege <[hidden email]>:
> >
> > > No, the word "singleton" here just means you get an automatic instance
> of
> > > your class, i.e. you can use the class name as if it were an object.
> You
> > >
> > automatic instance?
> >
> > maybe its a translation problem, but i try to understant: wiki said here:
> > http://gambaswiki.org/wiki/lang/createstatic
> > in a tip:
> > "allows you to implement the object-oriented programming singleton
> pattern
> > <http://en.wikipedia.org/wiki/Singleton_pattern>."
> > and i understand by singleton pattern that a only one instance du i was a
> > J2EE programer:
> > "restricts the instantiation
> > <https://en.wikipedia.org/wiki/Instantiation_%28computer_science%29> of
> a
> > class <https://en.wikipedia.org/wiki/Class_%28computer_programming%29>
> to
> > one object <https://en.wikipedia.org/wiki/Object_%28computer_science%29
> >.
> > This is useful when exactly one object is needed to coordinate actions
> > across the system"
> >
> > so here are some things that i cannot understant and i think its
> something
> > with translation or?
> >
>
> It's not a translation error, it is that "singleton" has a different
> meaning
> in the paragraph you cite than it has in Gambas. Actually, the
> documentation
> should probably avoid the word "singleton", because it creates confusion
> with
> a more established notion of "singleton" (the one you cite).
>
> Now, let me tell you again what the documentation means when it says
> "singleton". When you put the CREATE STATIC keyword into the top of your
> class, then the class will be made "auto-creatable". This means that if
> your Gambas program uses the class name like an object, e.g. by accessing
> a non-static property or method over the *class* name (which doesn't make
> sense), then the interpreter will create an object out of this class
> (the so-called automatic instance -- because the interpreter creates it
> automatically for you in the background as soon as you need it) and uses
> this object in place of the class name.
>
> CREATE STATIC does *not* ensure that you can create *only* one instance
> of the class. This is not what "singleton" means in Gambas. You can create
> multiple objects out of a CREATE STATIC class.
>
> There are two famous examples of auto-creatable (CREATE STATIC) classes,
> which I can think of off the top of my head:
>
>   (1) Settings (gb.settings), if you ever worked with it, is a class of
>       which you can create as many objects as you like, right? But you can
>       also use the class name "Settings" as if it were an object, e.g.
>
>         Print Settings["Key"]
>
>       Here it looks you access a key "Key" of the class Settings, but this
>       doesn't make sense as the array accessors aren't static methods of
> the
>       Settings class. In fact, Settings, in this case, behaves as if you
>       created as Settings object behind the scenes which is linked to the
>       default configuration file path $XDG_CONFIG_HOME &/ Application.Name
> & ".conf".
>       This is precisely the automatic instance of the Settings class.
>
>   (2) An even more prominent example: every Form class is auto-creatable.
>       Have you ever wondered why, if you start your GUI project with
> startup
>       form "FMain", a window pops up? You only have a Form class but you
>       never created an object of this Form class, so where does this window
>       come from? This also is the automatic instance of your class FMain,
>       showing itself on startup. You can also write
>
>         FMain.Center()
>
>       to center your main window on the screen. The class name "FMain"
>       does not refer to the class, but to the automatic instance, an
>       *object* of class FMain that the interpreter created and that is
>       used behind the scenes.
>
> This is the "singleton" behaviour that the documentation describes.
>
> >
> > > Nothing extraordinary happens. You have a dynamic class with a static
> > > variable and you can use the class like an object (as well as create
> new
> > > objects of that class).
> > >
> > for the variable:
> >
> > public statis var as string
> >
> > vs
> >
> > public var as strings
> >
> > doc wiki said "will be shared with all the class" seems that there's no
> > diference based on your answer
> >
> >
>
> I don't understand your objection at all. Maybe the above explanation
> clears
> things up for you?
>
> Regards,
> Tobi
>
> --
> "There's an old saying: Don't change anything... ever!" -- Mr. Monk
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Gambas-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: static ? in variables

Tobias Boege-2
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

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: static ? in variables

PICCORO McKAY Lenz
hi tobias, please , change you the now modified wiki page.. i changed maybe
before u read it!

and also change the spanish too,
http://gambaswiki.org/wiki/lang/createstatic?l=es

please change you or revised the actual and made right corrections.. i
think u visit the wiki after i made the changes.. i must added parto of
your explanation due the wiki has confuse info..

i will monitoring the wiki after you made some changes to also update the
spanish part

Lenz McKAY Gerardo (PICCORO)
http://qgqlochekone.blogspot.com

2017-06-15 15:02 GMT-04:00 Tobias Boege <[hidden email]>:

> 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
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Gambas-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: static ? in variables

PICCORO McKAY Lenz
ok tobias, i reading and property translated to spanish.. thanks for your
help.. (umm i thnik was too compresed the info.. but in any case ...)

http://gambaswiki.org/wiki/lang/createstatic?l=es

please for spanish use revised and compelte if need..

Lenz McKAY Gerardo (PICCORO)
http://qgqlochekone.blogspot.com

2017-06-15 15:15 GMT-04:00 PICCORO McKAY Lenz <[hidden email]>:

> hi tobias, please , change you the now modified wiki page.. i changed
> maybe before u read it!
>
> and also change the spanish too, http://gambaswiki.org/
> wiki/lang/createstatic?l=es
>
> please change you or revised the actual and made right corrections.. i
> think u visit the wiki after i made the changes.. i must added parto of
> your explanation due the wiki has confuse info..
>
> i will monitoring the wiki after you made some changes to also update the
> spanish part
>
> Lenz McKAY Gerardo (PICCORO)
> http://qgqlochekone.blogspot.com
>
> 2017-06-15 15:02 GMT-04:00 Tobias Boege <[hidden email]>:
>
>> 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
>>
>> ------------------------------------------------------------
>> ------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>> _______________________________________________
>> Gambas-user mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>
>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: static ? in variables

PICCORO McKAY Lenz
tobias..now making a library  in the ide, the class that not have the
"create static" now not permits instanciate the class

i only put a variable static, rest of class not have create static

Export

Private dblocal As String = "file1.txt"
Static Public status As Integer = 0

now the class "dbcontext" said cannot be instanciate, i do not have
the CREATE PRIVATE declaration inside it!




Lenz McKAY Gerardo (PICCORO)
http://qgqlochekone.blogspot.com

2017-06-15 16:07 GMT-04:00 PICCORO McKAY Lenz <[hidden email]>:

> ok tobias, i reading and property translated to spanish.. thanks for your
> help.. (umm i thnik was too compresed the info.. but in any case ...)
>
> http://gambaswiki.org/wiki/lang/createstatic?l=es
>
> please for spanish use revised and compelte if need..
>
> Lenz McKAY Gerardo (PICCORO)
> http://qgqlochekone.blogspot.com
>
> 2017-06-15 15:15 GMT-04:00 PICCORO McKAY Lenz <[hidden email]>:
>
>> hi tobias, please , change you the now modified wiki page.. i changed
>> maybe before u read it!
>>
>> and also change the spanish too, http://gambaswiki.org/wik
>> i/lang/createstatic?l=es
>>
>> please change you or revised the actual and made right corrections.. i
>> think u visit the wiki after i made the changes.. i must added parto of
>> your explanation due the wiki has confuse info..
>>
>> i will monitoring the wiki after you made some changes to also update the
>> spanish part
>>
>> Lenz McKAY Gerardo (PICCORO)
>> http://qgqlochekone.blogspot.com
>>
>> 2017-06-15 15:02 GMT-04:00 Tobias Boege <[hidden email]>:
>>
>>> 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
>>>
>>> ------------------------------------------------------------
>>> ------------------
>>> Check out the vibrant tech community on one of the world's most
>>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>> _______________________________________________
>>> Gambas-user mailing list
>>> [hidden email]
>>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>>
>>
>>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: static ? in variables

Tobias Boege-2
On Thu, 15 Jun 2017, PICCORO McKAY Lenz wrote:

> tobias..now making a library  in the ide, the class that not have the
> "create static" now not permits instanciate the class
>
> i only put a variable static, rest of class not have create static
>
> Export
>
> Private dblocal As String = "file1.txt"
> Static Public status As Integer = 0
>
> now the class "dbcontext" said cannot be instanciate, i do not have
> the CREATE PRIVATE declaration inside it!
>
Can you give a full project? The attached project contains everything
you said about your class, and it works. It is instantiable. Is the
*error message* really that the class cannot be instantiated or is
there another error which just prevents objects from being created,
e.g. you use the "status" variable in the _new method?

Regards,
Tobi

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

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user

test-0.0.1.tar.gz (15K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: static ? in variables

adamnt42@gmail.com
On Fri, 16 Jun 2017 12:38:50 +0200
Tobias Boege <[hidden email]> wrote:

> Can you give a full project? The attached project contains everything
> you said about your class, and it works. It is instantiable. Is the
> *error message* really that the class cannot be instantiated or is
> there another error which just prevents objects from being created,
> e.g. you use the "status" variable in the _new method?        <-----------?
>
> Regards,
> Tobi
>
> --
> "There's an old saying: Don't change anything... ever!" -- Mr. Monk

Eh? You can use static variables in dynamic methods... or Constants would never work.
(You cannot access dynamic variables from static methods.)

b
--
B Bruen <[hidden email] (sort of)>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: static ? in variables

Tobias Boege-2
On Fri, 16 Jun 2017, [hidden email] wrote:

> On Fri, 16 Jun 2017 12:38:50 +0200
> Tobias Boege <[hidden email]> wrote:
>
> > Can you give a full project? The attached project contains everything
> > you said about your class, and it works. It is instantiable. Is the
> > *error message* really that the class cannot be instantiated or is
> > there another error which just prevents objects from being created,
> > e.g. you use the "status" variable in the _new method?        <-----------?
> >
> > Regards,
> > Tobi
> >
> > --
> > "There's an old saying: Don't change anything... ever!" -- Mr. Monk
>
> Eh? You can use static variables in dynamic methods... or Constants would never work.
> (You cannot access dynamic variables from static methods.)
>

Right :-/ (in my defense, this was the first thing I did after waking up)

I should've just said: give a full project.

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

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: static ? in variables

PICCORO McKAY Lenz
umm i tested your "test.tar.gz" in gambas 3.1.1 and does not raised that
behaviour.. now i must go to my work and tested in gambas 3.9 due here was
where the problem ..

when the pup up help advise raises show that could be instanciated.. but i
just tested your "test.tar.gz" project attached previously (was just like
you do it) and its works

i post feedback .. maybe its a bug in generation of docs..

Lenz McKAY Gerardo (PICCORO)
http://qgqlochekone.blogspot.com

2017-06-16 6:33 GMT-04:30 Tobias Boege <[hidden email]>:

> On Fri, 16 Jun 2017, [hidden email] wrote:
> > On Fri, 16 Jun 2017 12:38:50 +0200
> > Tobias Boege <[hidden email]> wrote:
> >
> > > Can you give a full project? The attached project contains everything
> > > you said about your class, and it works. It is instantiable. Is the
> > > *error message* really that the class cannot be instantiated or is
> > > there another error which just prevents objects from being created,
> > > e.g. you use the "status" variable in the _new method?
> <-----------?
> > >
> > > Regards,
> > > Tobi
> > >
> > > --
> > > "There's an old saying: Don't change anything... ever!" -- Mr. Monk
> >
> > Eh? You can use static variables in dynamic methods... or Constants
> would never work.
> > (You cannot access dynamic variables from static methods.)
> >
>
> Right :-/ (in my defense, this was the first thing I did after waking up)
>
> I should've just said: give a full project.
>
> --
> "There's an old saying: Don't change anything... ever!" -- Mr. Monk
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Gambas-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: static ? in variables

PICCORO McKAY Lenz
tested was a cache doc problem maybe.. thanks ...

i now understand clarelly about class using static and private.. but for
variables:
wiki was:
"If the static keyword is specified, the same variable will be shared with
every object of this class."

well seems "Public var" and "Static public var" are equal and there's no
difference? so where are the logic with public static?

please iluminate me...

Lenz McKAY Gerardo (PICCORO)
http://qgqlochekone.blogspot.com

2017-06-16 7:43 GMT-04:00 PICCORO McKAY Lenz <[hidden email]>:

> umm i tested your "test.tar.gz" in gambas 3.1.1 and does not raised that
> behaviour.. now i must go to my work and tested in gambas 3.9 due here was
> where the problem ..
>
> when the pup up help advise raises show that could be instanciated.. but i
> just tested your "test.tar.gz" project attached previously (was just like
> you do it) and its works
>
> i post feedback .. maybe its a bug in generation of docs..
>
> Lenz McKAY Gerardo (PICCORO)
> http://qgqlochekone.blogspot.com
>
> 2017-06-16 6:33 GMT-04:30 Tobias Boege <[hidden email]>:
>
>> On Fri, 16 Jun 2017, [hidden email] wrote:
>> > On Fri, 16 Jun 2017 12:38:50 +0200
>> > Tobias Boege <[hidden email]> wrote:
>> >
>> > > Can you give a full project? The attached project contains everything
>> > > you said about your class, and it works. It is instantiable. Is the
>> > > *error message* really that the class cannot be instantiated or is
>> > > there another error which just prevents objects from being created,
>> > > e.g. you use the "status" variable in the _new method?
>> <-----------?
>> > >
>> > > Regards,
>> > > Tobi
>> > >
>> > > --
>> > > "There's an old saying: Don't change anything... ever!" -- Mr. Monk
>> >
>> > Eh? You can use static variables in dynamic methods... or Constants
>> would never work.
>> > (You cannot access dynamic variables from static methods.)
>> >
>>
>> Right :-/ (in my defense, this was the first thing I did after waking up)
>>
>> I should've just said: give a full project.
>>
>> --
>> "There's an old saying: Don't change anything... ever!" -- Mr. Monk
>>
>> ------------------------------------------------------------
>> ------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>> _______________________________________________
>> Gambas-user mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>
>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: static ? in variables

Tobias Boege-2
On Fri, 16 Jun 2017, PICCORO McKAY Lenz wrote:

> tested was a cache doc problem maybe.. thanks ...
>
> i now understand clarelly about class using static and private.. but for
> variables:
> wiki was:
> "If the static keyword is specified, the same variable will be shared with
> every object of this class."
>
> well seems "Public var" and "Static public var" are equal and there's no
> difference? so where are the logic with public static?
>
> please iluminate me...
>

"Public" or "Private" control the visibility of a symbol, whereas "Static"
(or leaving out "Static") controls the storage type of the variable.
A static variable is stored in the *class* and shared by all objects.
If you modify a static variable from one object, it will change for all
objects. This is orthogonal to visibility. You can combine Static with
Public or Private. Neither implies the other.

You should be familiar with this concept if you know Java and PHP.
It's about the same there, although I don't think Gambas has static
local variables, which is another place where the word "static" is
used in those languages.

In case you are confused because "Static" appears in two places (the
CREATE STATIC flag for classes and the STATIC keyword for variable/
property/method declaration), those two things aren't necessarily
related. For example, CREATE PRIVATE has no relation to private variable
declaration (where you also use PRIVATE) and no relation to the CREATE
flag you specify with the OPEN instruction for files. It's just that
those two words "CREATE" and "PRIVATE" already exist in Gambas and they
together kind of convey the meaning of "CREATE PRIVATE", namely that
you can't create objects of the class using NEW.

Regards,
Tobi

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

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: static ? in variables

PICCORO McKAY Lenz
2017-06-16 11:26 GMT-04:00 Tobias Boege <[hidden email]>:

> A static variable is stored in the *class* and shared by all objects.
> If you modify a static variable from one object, it will change for all
> objects. This is orthogonal to visibility. You can combine Static with
> Public or Private. Neither implies the other.
>
thanks i must confirm that due some concepts in gambas are very different
respect java or php... and confused too much ...


>
> You should be familiar with this concept if you know Java and PHP.
> It's about the same there, although I don't think Gambas has static
> local variables, which is another place where the word "static" is
> used in those languages.
>
> In case you are confused because "Static" appears in two places (the
> CREATE STATIC flag for classes and the STATIC keyword for variable/
> property/method declaration), those two things aren't necessarily
> related. For example, CREATE PRIVATE has no relation to private variable
> declaration (where you also use PRIVATE) and no relation to the CREATE
> flag you specify with the OPEN instruction for files. It's just that
> those two words "CREATE" and "PRIVATE" already exist in Gambas and they
> together kind of convey the meaning of "CREATE PRIVATE", namely that
> you can't create objects of the class using NEW.
>
thanks for clarify..  that information unless you think its very necesary..
due some differences..

i cited the wiki introduction that said Gambas its NO SAME as visual
basic.. but its too similar. but not equal..

now i have a correct information.


>
> Regards,
> Tobi
>
> --
> "There's an old saying: Don't change anything... ever!" -- Mr. Monk
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Gambas-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Loading...