property contents

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10098
Joined: Fri Feb 19, 2010 10:17 am

Re: property contents

Post by richmond62 » Sat Apr 18, 2020 11:03 am

I dunno: BUT . . . with code like this:

Code: Select all

on openStack
put 42 into ADAMS
put 69 into KLAUS
end openStack
those 2 'variables' will remain "there". 8)
Last edited by richmond62 on Sat Apr 18, 2020 12:14 pm, edited 1 time in total.

Klaus
Posts: 14194
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: property contents

Post by Klaus » Sat Apr 18, 2020 11:48 am

That's cheating! :D

bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: property contents

Post by bogs » Sat Apr 18, 2020 11:48 am

You sure they 'remain' there? I do not think that word means what you think that it means... :P
Image

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10098
Joined: Fri Feb 19, 2010 10:17 am

Re: property contents

Post by richmond62 » Sat Apr 18, 2020 12:17 pm

Well: for starters variables are by definition labile things that come and go,
and by that definition variables never remain and it is a daft question to ask
if they persist.

Constants on the other hand, are . . . constant (quelle surprise). 8)

My, admittedly goofy, previous posting featured constants masquerading as variables.

All that really served was to show what a silly question someone asked about persistence of variables.

bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: property contents

Post by bogs » Sat Apr 18, 2020 12:33 pm

richmond62 wrote:
Sat Apr 18, 2020 12:17 pm
My, admittedly goofy, previous posting featured constants masquerading as variables.
It does no such thing, you silly goose. It creates and fills 2 variables -

Code: Select all

put 42 into ADAMS
put 69 into KLAUS
- however, the variables themselves do not remain, they are re-built each time. This is not the same as putting information into a custom property while in the dev. stage, which as was pointed out *does* remain in whatever form you left it in while entering it.

A constant really is a completely different topic, but closer to your variables than a custom property :D
Image

SparkOut
Posts: 2945
Joined: Sun Sep 23, 2007 4:58 pm

Re: property contents

Post by SparkOut » Sat Apr 18, 2020 1:06 pm

but isn't 42 a constant? and 69 another constant? :lol: OK, I'll shut up now

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10098
Joined: Fri Feb 19, 2010 10:17 am

Re: property contents

Post by richmond62 » Sat Apr 18, 2020 1:33 pm

you silly goose
Well . . . if I'm the goose, what does that make you? 8)
-
goose.jpg
-
Creating and filling 2 variables every time a stack is launched is de facto the same as establishing 2 constants,
there is the possibility, of course, beyond pre-established constants such as 'pi' built into the language, no constants exist in LiveCode
at all.

bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: property contents

Post by bogs » Sat Apr 18, 2020 1:44 pm

SparkOut wrote:
Sat Apr 18, 2020 1:06 pm
but isn't 42 a constant? and 69 another constant? :lol: OK, I'll shut up now
Um... no :P
richmond62 wrote:
Sat Apr 18, 2020 1:33 pm
Well . . . if I'm the goose, what does that make you?
I'd say your picture is quite accurate...GOOSE :twisted:
richmond62 wrote:
Sat Apr 18, 2020 1:33 pm
Creating and filling 2 variables every time a stack is launched is de facto the same as establishing 2 constants,
No, it is not even close. Those two variables can be changed at any time you feel like it. A constant is just that, constant. Pi is a constant. You can not change Pi just because you feel they got it wrong. You can't change it by adding whipped cream either.
Image

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10098
Joined: Fri Feb 19, 2010 10:17 am

Re: property contents

Post by richmond62 » Sat Apr 18, 2020 1:46 pm

Yes: of course you can change a variable that has been established in the way I indicated.

The question is, can a programmer set new constants in LiveCode other than those inherent in the language?

A custom property can also be judged as a container holding a variable.

I don't know which cultural tradition you come from bogs, but all the traditions I am aware of
do not view foxes positively. :D

Oh, and let's chuck another spanner in the works:

https://en.wikipedia.org/wiki/Control_variable

bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: property contents

Post by bogs » Sat Apr 18, 2020 3:42 pm

You are bringing pendanticism to a whole new level heh heh.
richmond62 wrote:
Sat Apr 18, 2020 1:46 pm
The question is, can a programmer set new constants in LiveCode other than those inherent in the language?
Yes, HOWEVER....
Lc Dictionary wrote: Once you have defined a constant, you cannot redefine it in the same handler; doing so causes an execution error.
richmond62 wrote:
Sat Apr 18, 2020 1:46 pm
A custom property can also be judged as a container holding a variable.
Well, your half right, it is a container after all, and you *can* put variables into it, however it is not a variable in and of itself, as the name explicitly states, it is a property. If you set the visible of (control x) to false, you are setting a property, not entering a variable. While the word 'Red' *could* be used in a variable, if an object is 'Red', that is a part and parcel of said object, therefore a 'property'.
richmond62 wrote:
Sat Apr 18, 2020 1:46 pm
I don't know which cultural tradition you come from bogs, but all the traditions I am aware of
do not view foxes positively.
I try not to be a slave to others opinions :twisted:
From what I've seen, any small animal that is forced to compete against a platoon of riders and a pack of dogs and still has even odds on getting out of the whole thing is probably one damn clever little critter.
richmond62 wrote:
Sat Apr 18, 2020 1:46 pm
Oh, and let's chuck another spanner in the works:
https://en.wikipedia.org/wiki/Control_variable
Not much of a spanner, I'm sure you read it, now go back and read it again until comprehension sinks in.
Image

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10317
Joined: Wed May 06, 2009 2:28 pm

Re: property contents

Post by dunbarx » Sat Apr 18, 2020 5:35 pm

Richmond.

I am with Bogs and Klaus on this. In fact, I am sure you know better. There is nothing at all similar to creating a variable in an openStack handler, and setting and saving a custom property. You are conflating two radically different gadgets. Surely you know this.

The variables you snuck into the mix do NOT survive sessions, as you know. CP's do survive, as you know.

I hope this was not just an excuse to upload one of those cute cartoons you are so fond of. 8)

Craig

SparkOut
Posts: 2945
Joined: Sun Sep 23, 2007 4:58 pm

Re: property contents

Post by SparkOut » Sat Apr 18, 2020 6:12 pm

Yes, although I am wondering how inconstant 42 could be. Not "42".

Code: Select all

Put 42 into tVar
cannot put anything but 42 into tVar. 42 is a constant, representing the integer value 42,and nothing else if you ask me.
But then you didn't ask me, I asked you so, there's a different answer. Clearly the question is not a constant.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10317
Joined: Wed May 06, 2009 2:28 pm

Re: property contents

Post by dunbarx » Sat Apr 18, 2020 6:13 pm

Richmond wrote:
The question is, can a programmer set new constants in LiveCode other than those inherent in the language?
Sure you can, as long as you name them something unique. And I know a great way to do this:

Code: Select all

on mouseUp
  set the doublePi of this stack to "6.28"
  end mouseUp
Voila. A new, permanent constant. And we were able to use a custom property to make it happen! Oh, bliss...

Craig

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10317
Joined: Wed May 06, 2009 2:28 pm

Re: property contents

Post by dunbarx » Sat Apr 18, 2020 6:21 pm

We are off in pedantic weeds a bit. The dictionary says this about constants:
A value that has a name, like a variable, but that doesn't change.
Well, that phrasing might do with an update, say to:
"A value that has a name, like a variable, but is native to LC, and cannot change."
So "pi", or my favorite, "empty", are constants. "42", however beloved by most of the more advanced members of this forum, is an integer, and if assigned a name, it is a variable.

Constants are built into the language. Variables are built by programmers. I suspect that everyone knows this, and that the confinement of these days is making people silly.

This is not a bad thing.

Craig

SparkOut
Posts: 2945
Joined: Sun Sep 23, 2007 4:58 pm

Re: property contents

Post by SparkOut » Sat Apr 18, 2020 7:13 pm

My take, is

Code: Select all

put pi into tVar
is not intrinsically different to

Code: Select all

put 42 into tVar
"if assigned a name" is moot. It already has a name. 42 is not "42".
But I only meant to be lighthearted. I think we're off beyond the pedantic weeds into the Arcturian Mega Golf rough.

Post Reply