Re: Script Only Stack Properties

2020-04-04 Thread David Bovill via use-livecode
The approach I take is to use getorop and set prop handlers for this. The data 
is then seperated from the code and Ibuse one standardised technique for 
accessing a model:

out the model_Data of stack stackName into someData
On 4 Apr 2020, 19:39 +0100, How to use LiveCode 
, wrote:
>
> ?
>
> What are objects but a type declaration followed by a set of properties
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Script Only Stack Properties

2020-04-04 Thread Richard Gaskin via use-livecode

Bob Sneidar wrote:

> True, but with properties, I can envision a use case for persistent
> values between sessions.

Persistence is essential in many contexts.  But is it necessary that 
data be bound to code?


Sometimes it is.  When it is, is it necessary that the file format be text?


> This is quite separate from GUI objects.

Is it?

What are objects but a type declaration followed by a set of properties?


> By saving and reloading properties of a script only stack, everything
> is still text file only based.

Encoding the array would be the simplest, fastest, and most robust 
option.  LSON is to LC what JSON is to JS, the most with-the-grain 
serialization method for the scripting engine it was designed for.


But in one respect LSON is more akin to MondgoDB's BSON: it's more 
efficient than JSON because the format is binary, requiring fewer steps 
to de-serialize.


So if your circumstance requires you to be working exclusively with text 
files, LSON is a non-starter.


Then you can choose among JSON, YAML, XML, ISHI, or any number of other 
plain-text serialization formats.



When I need to combine code with data, I usually use stack files.

If I need data alone, I often use LSON.

If the project requires that the storage format be interoperable, then I 
look at other options.


--
 Richard Gaskin
 Fourth World Systems
 Software Design and Development for the Desktop, Mobile, and the Web
 
 ambassa...@fourthworld.comhttp://www.FourthWorld.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Script Only Stack Properties

2020-04-04 Thread Bob Sneidar via use-livecode
True, but with properties, I can envision a use case for persistent values 
between sessions. This is quite separate from GUI objects. By saving and 
reloading properties of a script only stack, everything is still text file only 
based.

Bob S


On Apr 4, 2020, at 11:17 AM, Richard Gaskin via use-livecode 
mailto:use-livecode@lists.runrev.com>> wrote:

Bob Sneidar wrote:

> Hmmm… If that is the case then theoretically, on closeStack the new
> properties could be arrayEncoded and saved to disk, and then on
> openStack they could be read and then arrayDecoded and reset again.

Stacks can also contain controls, each of which can be expressed as an array of 
properties.

You could craft an array-based format to allow storage and recreation of even 
complex GUI stacks.

What you'd have is a binary file dependent on a lot of scripted code.

Meanwhile, we already have a binary format handled robustly in the compiled 
object code of the engine. :)

--
Richard Gaskin
Fourth World Systems
Software Design and Development for the Desktop, Mobile, and the Web

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Script Only Stack Properties

2020-04-04 Thread Richard Gaskin via use-livecode

Bob Sneidar wrote:

> Hmmm… If that is the case then theoretically, on closeStack the new
> properties could be arrayEncoded and saved to disk, and then on
> openStack they could be read and then arrayDecoded and reset again.

Stacks can also contain controls, each of which can be expressed as an 
array of properties.


You could craft an array-based format to allow storage and recreation of 
even complex GUI stacks.


What you'd have is a binary file dependent on a lot of scripted code.

Meanwhile, we already have a binary format handled robustly in the 
compiled object code of the engine. :)


--
 Richard Gaskin
 Fourth World Systems
 Software Design and Development for the Desktop, Mobile, and the Web
 
 ambassa...@fourthworld.comhttp://www.FourthWorld.com


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Script Only Stack Properties

2020-04-04 Thread Richard Gaskin via use-livecode

Bob Sneidar wrote:

> I just discovered an interesting aspect of script only stacks. They
> CAN have Custom Properties… but ONLY while in memory! Once closed, the
> properties disappear. Seems like a slight mod would be able to save
> these properties as a separate file so that they can remain
> persistent.

Yep. So much of the difficulty folks have had using SoS come from just 
over-thinking them.


A stack is a stack is a stack.

With script-only stacks there is one distinction: the storage format 
contains only the stack script, and optionally a behavior reference.


That's it.

Everything else you can do with a stack at runtime can be done with any 
stack, regardless of its storage format.


Indeed, nearly everything we see in the IDE these days are SoS.

--
 Richard Gaskin
 Fourth World Systems
 Software Design and Development for the Desktop, Mobile, and the Web
 
 ambassa...@fourthworld.comhttp://www.FourthWorld.com


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Script Only Stack Properties

2020-04-04 Thread Bob Sneidar via use-livecode
Hmmm… If that is the case then theoretically, on closeStack the new properties 
could be arrayEncoded and saved to disk, and then on openStack they could be 
read and then arrayDecoded and reset again.

Bob S


On Apr 4, 2020, at 10:20 AM, J. Landman Gay via use-livecode 
mailto:use-livecode@lists.runrev.com>> wrote:

When a script only stack is opened, LC creates a temporary stack and plops the 
script into it. At that point its just like any other library stack. You could 
add images, controls, other scripts, custom props, anything. The only 
difference is that when the stack closes, the text of the stack script is 
written back to the file and everything else is lost.

I suppose you could put custom properties at the top of the stack script inside 
a comment block, and set them up normally by script when the stack opens.

--
Jacqueline Landman Gay | 
jac...@hyperactivesw.com
HyperActive Software | 
http://www.hyperactivesw.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Script Only Stack Properties

2020-04-04 Thread J. Landman Gay via use-livecode
When a script only stack is opened, LC creates a temporary stack and plops 
the script into it. At that point its just like any other library stack. 
You could add images, controls, other scripts, custom props, anything. The 
only difference is that when the stack closes, the text of the stack script 
is written back to the file and everything else is lost.


I suppose you could put custom properties at the top of the stack script 
inside a comment block, and set them up normally by script when the stack 
opens.


--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
On April 4, 2020 11:58:33 AM Bob Sneidar via use-livecode 
 wrote:



Hi all.

I just discovered an interesting aspect of script only stacks. They CAN 
have Custom Properties… but ONLY while in memory! Once closed, the 
properties disappear. Seems like a slight mod would be able to save these 
properties as a separate file so that they can remain persistent.


Gonna hafta look into this!

Bob S

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your 
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-livecode





___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode