Updating Text-Script Only Stacks in Run-Time, Message Path Memory

classic Classic list List threaded Threaded
20 messages Options
Reply | Threaded
Open this post in threaded view
|

Updating Text-Script Only Stacks in Run-Time, Message Path Memory

Sannyasin Brahmanathaswami
I ran into this today: Run a boot stack that has a list of stack files,
Initialization script loads N number of stacks as libs with "start using stack x" on a loop

So far so good. I can run cmds from the message box to fire handlers in any of the stacks that were loaded with "start using"

Run into small bug… need to do some testing. All the stacks in use appear in the project browser

Open script of stack "model_preferences"  in the script editor,  Add a new handler

command checkPrefsFilePath
  answer "Hello" with "Gotcha"
# my default test just to see if the handler is in the message path before actually "coding it out"
end checkPrefsFilePath

--click yellow button… save … LC IDE flashes the "saving stack… " modal…
--go to message box; enter "checkPrefsFilePath"
--msg box returns

"checkPrefsFilePath"  and does not fire my handler… I set a break point on another handler that was in the script before startup of this session

go to msg box; enter "setPref"
and it breaks on my break point: ergo the engine sees it/found it.

But the engine does not yet "see" my new handler.  Just for fun: open stack file on disk.. in BBEdit: yes, confirmed, my changes are there.

ERGO conclude: editing a script only stack and saving it does *not* update the "live" version of that file in memory that is in use by the engine.

I guess this "kinda" makes sense, since the message path was already "assembled' at start up and editing and save script only stacks doesn’t' necessary make any change to that message path.

But, am I the only on that thinks this is odd behavior? If I am right, doesn't it break the "write, run with no compile" principle of LiveCode?  If I edit the script of a binary stack, those changes are immediately implemented. Should it not be the same for script only stacks?

OK, so given the current behavior, assuming I'm not missing something simple, do we have to manually re-issue a "start using stack "preferences.livecodescript" every time we edit it's script?

What am I missing.

BR







_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Updating Text-Script Only Stacks in Run-Time, Message Path Memory

J. Landman Gay
On 11/5/16 10:04 AM, Sannyasin Brahmanathaswami wrote:
> But the engine does not yet "see" my new handler.  Just for fun: open
> stack file on disk.. in BBEdit: yes, confirmed, my changes are
> there.
>
> ERGO conclude: editing a script only stack and saving it does *not*
> update the "live" version of that file in memory that is in use by
> the engine.

Actually, I've seen the same thing occasionally in regular stack scripts
too, not just script-only stacks. There's been an issue with window
confusion for some time, but I have never been able to get a reliable
recipe.

--
Jacqueline Landman Gay         |     [hidden email]
HyperActive Software           |     http://www.hyperactivesw.com

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Updating Text-Script Only Stacks in Run-Time, Message Path Memory

Sannyasin Brahmanathaswami
right… not the engine…
some IDE gremlin…
restarted LC…

open some script only stack that had been put into use earlier,
edit save and the changes are available runtime.  

So, yes… something is causing the IDE not to pick up the changes in the open scripts and (re)placing it in the message path.

no recipe…

BR
 

On 11/5/16, 9:28 AM, "use-livecode on behalf of J. Landman Gay" <[hidden email] on behalf of [hidden email]> wrote:

    >
    >ERGO conclude: editing a script only stack and saving it does *not*
    >update the "live" version of that file in memory that is in use by
    >the engine.
   
    Actually, I've seen the same thing occasionally in regular stack scripts
    too, not just script-only stacks. There's been an issue with window
    confusion for some time, but I have never been able to get a reliable
    recipe.

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Updating Text-Script Only Stacks in Run-Time, Message Path Memory

mwieder
On 11/05/2016 02:39 PM, Sannyasin Brahmanathaswami wrote:

> So, yes… something is causing the IDE not to pick up the changes in the open scripts and (re)placing it in the message path.

Yep. It's one of the two reasons I don't use script-only stacks.

--
  Mark Wieder
  [hidden email]

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
--
 Mark Wieder
 ahsoftware@gmail.com
Reply | Threaded
Open this post in threaded view
|

Re: Updating Text-Script Only Stacks in Run-Time, Message Path Memory

Monte Goulding-2

> On 6 Nov. 2016, at 1:33 pm, Mark Wieder <[hidden email]> wrote:
>
>> So, yes… something is causing the IDE not to pick up the changes in the open scripts and (re)placing it in the message path.
>
> Yep. It's one of the two reasons I don't use script-only stacks.

From the sounds of the original description I’m more suspicious of the message box than anything to do with loading the script correctly when it’s applied or script only stacks. The message box does a certain amount of jiggery pokery to interpret what you enter.

FWIW I work with script only stacks most of the time and have not noticed anything like this. Of course if you are making changes in a text editor and expecting those to be reflected in the running IDE then you are out of luck.

Cheers

Monte
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Updating Text-Script Only Stacks in Run-Time, Message Path Memory

mwieder
On 11/05/2016 09:31 PM, Monte Goulding wrote:

 > Of course if you are making changes in a text editor and expecting
those to be reflected in the running IDE then you are out of luck.

But...
shouldn't that be the big advantage of script-only stacks?

--
  Mark Wieder
  [hidden email]

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
--
 Mark Wieder
 ahsoftware@gmail.com
Reply | Threaded
Open this post in threaded view
|

Re: Updating Text-Script Only Stacks in Run-Time, Message Path Memory

Monte Goulding-2

> On 7 Nov. 2016, at 3:23 am, Mark Wieder <[hidden email]> wrote:
>
> But...
> shouldn't that be the big advantage of script-only stacks?

I think this would be relatively handy for trivial stacks but have issues for more complicated ones. Also consider why should this only be the case for script only stacks? If I git checkout and I have a binary stack diff shouldn’t that stack reload too? After all there could be dependencies between the script only stacks and the binary one (they could be its behaviors or something).

This introduces some interesting initialisation issues. What if the initialisation is the thing that changed? What if script local values are not appropriate for the new version? What if there’s some self generating UI that isn’t there because only the script was updated. What if I’m mid merge or rebase and there’s conflict markers in the file so it doesn’t compile?

I guess it’s possibly OK to have a go updating and the user can restart if they need but I’m not overly sure it’s a good idea.

Cheers

Monte
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Updating Text-Script Only Stacks in Run-Time, Message Path Memory

mwieder
On 11/06/2016 11:36 AM, Monte Goulding wrote:

> This introduces some interesting initialisation issues. What if the initialisation is the thing that changed? What if script local values are not appropriate for the new version? What if there’s some self generating UI that isn’t there because only the script was updated. What if I’m mid merge or rebase and there’s conflict markers in the file so it doesn’t compile?

I don't think this is specific to script-only stacks.
If I have an initialization routine in a sscript and I edit the script
in the IDE, I won't expect it to get called unless I do so explicitly.

If I edit a behavior script then I expect objects using that behavior
script to use the new features as soon as I compile the script. I would
expect that the same would be true of script-only stacks: I edit the
script, and on saving the text I would expect it to modify what the
script does. I don't expect that I would have to unload and reload (or
whatever the proper procedure is) to get the code to stick.

If the script doesn't compile then of course I wouldn't expect the
executing code to change. But that's no different from the way things
work now: my experience has been that script-only stacks will fail
silently on errors or in ways that give no clue as to what went wrong.

--
  Mark Wieder
  [hidden email]

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
--
 Mark Wieder
 ahsoftware@gmail.com
Reply | Threaded
Open this post in threaded view
|

Re: Updating Text-Script Only Stacks in Run-Time, Message Path Memory

Monte Goulding-2

> On 7 Nov. 2016, at 7:52 am, Mark Wieder <[hidden email]> wrote:
>
> If I edit a behavior script then I expect objects using that behavior script to use the new features as soon as I compile the script. I would expect that the same would be true of script-only stacks: I edit the script, and on saving the text I would expect it to modify what the script does.

It does as long as you edit it in the IDE. If you don’t want to edit in the IDE then you need something like the external editor solution that is around or something that just polls the file to check for an update then applies the script.

> I don't expect that I would have to unload and reload (or whatever the proper procedure is) to get the code to stick.

You only need to do that if you don’t edit in the IDE. I don’t believe there’s ever been official support for editing stack scripts outside the IDE.
>
> If the script doesn't compile then of course I wouldn't expect the executing code to change. But that's no different from the way things work now: my experience has been that script-only stacks will fail silently on errors or in ways that give no clue as to what went wrong.

The IDE doesn’t know much about script only stacks so I’d be surprised if any differences in behaviour can be attributed to the fact it’s script only. There really is very little difference between a script only stack and a regular stack other than reading and writing to disk and a single boolean flag in the class.

Cheers

Monte
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Updating Text-Script Only Stacks in Run-Time, Message Path Memory

Stephen Barncard-4
On Sun, Nov 6, 2016 at 1:00 PM, Monte Goulding <[hidden email]> wrote:

> You only need to do that if you don’t edit in the IDE. I don’t believe
> there’s ever been official support for editing stack scripts outside the
> IDE.


We already edit livecode script-only-stacks on server.

The only caveat. I would imagine is to make sure the editor you use has the
correct text attributes and line termination values.  When I use Coda  or
Textmate in conjunction with Transmit, double clicking a file in the FTP
listing will launch the chosen editor, open the text in a page, and when
one saves, it saves back to the file, wherever it is, and the FTP program
keeps it all straight.  I've edited stacks on a remote server and launched
my local Livecode app this way too.

Anyway, that was long winded.  Make sure your editor puts out the right
sentence termination characters.

Stephen Barncard - Sebastopol Ca. USA -
mixstream.org
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Updating Text-Script Only Stacks in Run-Time, Message Path Memory

Monte Goulding-2

> On 7 Nov. 2016, at 11:23 am, stephen barncard <[hidden email]> wrote:
>
> We already edit livecode script-only-stacks on server.

Sure you can edit them in a text editor that’s fine. What we are talking about is having those changes update the version that is currently loaded into a running IDE.

Cheers

Monte
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Updating Text-Script Only Stacks in Run-Time, Message Path Memory

Stephen Barncard-4
On Sun, Nov 6, 2016 at 4:27 PM, Monte Goulding <[hidden email]> wrote:

> Sure you can edit them in a text editor that’s fine. What we are talking
> about is having those changes update the version that is currently loaded
> into a running IDE.


I remember Jacque something about using 'revert' for a situation like this,
but that was for stack files.

there used to be a plugin that did this. Either Trevor or Ken Ray made it.

Stephen Barncard - Sebastopol Ca. USA -
mixstream.org
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Updating Text-Script Only Stacks in Run-Time, Message Path Memory

mwieder
In reply to this post by Monte Goulding-2
On 11/06/2016 01:00 PM, Monte Goulding wrote:

> The IDE doesn’t know much about script only stacks so I’d be surprised if any differences in behaviour can be attributed to the fact it’s script only. There really is very little difference between a script only stack and a regular stack other than reading and writing to disk and a single boolean flag in the class.

Really?
I can assign substacks to script-only stacks?
I can use a script-only stack as a substack?

--
  Mark Wieder
  [hidden email]

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
--
 Mark Wieder
 ahsoftware@gmail.com
Reply | Threaded
Open this post in threaded view
|

Re: Updating Text-Script Only Stacks in Run-Time, Message Path Memory

Monte Goulding-2

> On 7 Nov. 2016, at 6:37 pm, Mark Wieder <[hidden email]> wrote:
>
> Really?
> I can assign substacks to script-only stacks?
> I can use a script-only stack as a substack?

Sure but nothing but the stack script will save. I think for sanity we have disabled setting of substacks via the property inspector though.

A good chunk of the IDE is script only stacks that build their UI in script.

Cheers

Monte
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Updating Text-Script Only Stacks in Run-Time, Message Path Memory

axwald
In reply to this post by Sannyasin Brahmanathaswami
Hi,
Sannyasin Brahmanathaswami wrote
ERGO conclude: editing a script only stack and saving it does *not* update the "live" version of that file in memory that is in use by the engine.
I'd assume this to be legit & desired behavior. Imagine, your StandAlone loads an utility stack from the web ("start using stack URL MyURL") - you want it resident in memory, and you don't want it to be loaded again each time you use a function in it, right?

You can change it as desired (on the web, using the IDE or an editor), but your StandAlone will keep running it from memory until you tell it to reload it - usually via reboot, or a custom "reload" msg. That's what I'd expect, and is coherent with other software.

For sure, the IDE could help you with such, and auto-update the changed "used stack" in the main stack. But is it really desirable to have the IDE working different than the finished product? I'd rather realize my forgetting to add a "reload" handler before I compile the StandAlone ...

Have fun!
            axwald @ forums.livecode.com
• Livecode programming until the cat hits the fan •
Reply | Threaded
Open this post in threaded view
|

Re: Updating Text-Script Only Stacks in Run-Time, Message Path Memory

Mark Waddingham-2
In reply to this post by Sannyasin Brahmanathaswami
On 2016-11-05 16:04, Sannyasin Brahmanathaswami wrote:
> But, am I the only on that thinks this is odd behavior? If I am right,
> doesn't it break the "write, run with no compile" principle of
> LiveCode?  If I edit the script of a binary stack, those changes are
> immediately implemented. Should it not be the same for script only
> stacks?

No it is not odd behavior.

No it doesn't break the edit-run live - since you haven't edited the
stack within the engine you have loaded it into. (e.g. Open a binary
stackfile into two instances of the IDE, edit in one and save and
observe that the changes don't appear in the other instance of the IDE.)

Yes it is the same behavior as binary stackfiles - binary/script only
stackfiles only affect how the stack is saved on disk and absolutely
nothing else.

Upshot: Don't expect editing a script-only stackfile outside of the
engine it is loaded into to do anything different from a binary
stackfile in the same situation.

> OK, so given the current behavior, assuming I'm not missing something
> simple, do we have to manually re-issue a "start using stack
> "preferences.livecodescript" every time we edit it's script?

No - you have to delete and reload the stack if you edit it's script
outside of the engine it is loaded into - just as you would with a
binary stackfile.

The point here is that the purpose of script-only stackfiles is purely
that of storage - storage in a form which means they work well with
version control such as git.

Certainly, you can edit them in text editors outside the IDE; and for
some things that can be more convenient. However doing so is no
different from loading a stackfile into an IDE and editing it there.

Warmest Regards,

Mark.

--
Mark Waddingham ~ [hidden email] ~ http://www.livecode.com/
LiveCode: Everyone can create apps

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Updating Text-Script Only Stacks in Run-Time, Message Path Memory

Richard Gaskin
Mark Waddingham wrote:

 > The point here is that the purpose of script-only stackfiles is
 > purely that of storage - storage in a form which means they work
 > well with version control such as git.

This can't be stressed enough.

The only difference between script-only stacks and traditional binary
stacks is what's stored when saving.

As the term makes explicit, with a script-only stack the only thing that
gets saved is the stack script.

In every other way they are identical. Indeed, as far as I can tell once
they're loaded they are indeed the exact same structure in memory as any
other stack.

And like any stack, as long as they're in memory you can do anything you
like with them, even adding cuatom props or substacks.

But when you save, only the script will be preserved, as the name tries
to make clear.

This may be useful for allowing ephemeral data to be bound to such a
stack at runtime, safely refreshed with each session by virtue of never
having been saved at all.

And of course if you need persistence with such additions, just use a
traditional binary stack.

Conversations about script-only stacks have been much more complex than
the subject itself.

If it helps, there is only one rule to remember:

    A stack object is a stack object; the only difference
    with a script-only stack is that only the stack script
    is saved to disk.

--
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  [hidden email]                http://www.FourthWorld.com

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

RE: Updating Text-Script Only Stacks in Run-Time, Message Path Memory

Ralph DiMola
Richard,

Thanks for the pithy explanation! I think the most import thing for the
developer's design philosophy in your narrative is:

"This may be useful for allowing ephemeral data to be bound to such a stack
at runtime, safely refreshed with each session by virtue of never having
been saved at all."

Ralph DiMola
IT Director
Evergreen Information Services
[hidden email]


-----Original Message-----
From: use-livecode [mailto:[hidden email]] On Behalf
Of Richard Gaskin
Sent: Monday, November 07, 2016 11:25 AM
To: [hidden email]
Subject: Re: Updating Text-Script Only Stacks in Run-Time, Message Path
Memory

Mark Waddingham wrote:

 > The point here is that the purpose of script-only stackfiles is  > purely
that of storage - storage in a form which means they work  > well with
version control such as git.

This can't be stressed enough.

The only difference between script-only stacks and traditional binary stacks
is what's stored when saving.

As the term makes explicit, with a script-only stack the only thing that
gets saved is the stack script.

In every other way they are identical. Indeed, as far as I can tell once
they're loaded they are indeed the exact same structure in memory as any
other stack.

And like any stack, as long as they're in memory you can do anything you
like with them, even adding cuatom props or substacks.

But when you save, only the script will be preserved, as the name tries to
make clear.

This may be useful for allowing ephemeral data to be bound to such a stack
at runtime, safely refreshed with each session by virtue of never having
been saved at all.

And of course if you need persistence with such additions, just use a
traditional binary stack.

Conversations about script-only stacks have been much more complex than the
subject itself.

If it helps, there is only one rule to remember:

    A stack object is a stack object; the only difference
    with a script-only stack is that only the stack script
    is saved to disk.

--
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  [hidden email]                http://www.FourthWorld.com

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Updating Text-Script Only Stacks in Run-Time, Message Path Memory

mwieder
In reply to this post by Richard Gaskin
app.
Richard Gaskin wrote
This can't be stressed enough.

The only difference between script-only stacks and traditional binary
stacks is what's stored when saving.
OK - I stand corrected then.

I thought script-only stacks had to be separate files. I didn't realize they could be attached as substacks and bound into standalone apps. That does make a difference.
--
 Mark Wieder
 ahsoftware@gmail.com
Reply | Threaded
Open this post in threaded view
|

Re: Updating Text-Script Only Stacks in Run-Time, Message Path Memory

Richard Gaskin
mwieder wrote:
 > I thought script-only stacks had to be separate files. I didn't
 > realize they could be attached as substacks and bound into standalone
 > apps. That does make a difference.

Hmmm...I'm not sure that they can.  For a script-only stack to be truly
script-only, it would need to be saved only as the stack script in a
text file.

If later the mainstack of a script-only stack is changed to be a binary
stack, I would imagine that the script-only stack would no longer be
script-only, attached to the new mainstack as a binary stack since it's
now part of the binary structure of the mainstack.

--
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  [hidden email]                http://www.FourthWorld.com

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode