Understanding 'the defaultStack'

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

Re: Understanding 'the defaultStack'

Graham Samuel-4
Yes, but the way I think of it is if you do a ‘go’ to another stack, then the defaultStack changes so that you can make shorter references to objects in what is most likely then the current stack of interest. I got in a muddle  because that isn’t always true. I suppose I rubbed along for a few years before I got hit by that particular gotcha, so in a way Richard you’re right. Good documentation is probably all that’s needed, rather than trying to alter the engine’s behaviour.

My two Brexit-influenced, over-valued, eurocents.

Graham

> On 14 Oct 2016, at 23:08, Richard Gaskin <[hidden email]> wrote:
>
> Monte Goulding wrote:
>
> >> On 15 Oct 2016, at 8:01 AM, Richard Gaskin wrote:
> >>
> >> I can't recall the last time I needed defaultStack.  It may well
> >> have been quite recently, but it must being doing what I expected
> >> it to do since I've never had to think about it before this thread.
> >
> > Every time you use an object reference that doesn’t contain an
> > explicit stack reference you are using the defaultStack. You might
> > not be getting or setting the value but you would be depending on
> > it in a large part of your code.
>
> Exactly.  It must be working pretty well as it is or we would have had many more confused posts for decades rather than just a dozen only very recently.
>
> --
> 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: Understanding 'the defaultStack'

Bob Sneidar-2
In reply to this post by Richard Gaskin
I think the more experienced devs have found ways to work around it. When in doubt, they use absolute references and don't depend on the engine to resolve relative references for them. I'm not sure if that makes your point or counters it. ;-)

Bob S


On Oct 14, 2016, at 14:08 , Richard Gaskin <[hidden email]<mailto:[hidden email]>> wrote:

Exactly.  It must be working pretty well as it is or we would have had many more confused posts for decades rather than just a dozen only very recently.

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

_______________________________________________
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: Understanding 'the defaultStack'

Bob Sneidar-2
In reply to this post by Peter Bogdanoff
That breaks Dr. Raney's rule. I'm not sure who I am anymore...

Bob S


On Oct 14, 2016, at 14:21 , Peter Bogdanoff <[hidden email]<mailto:[hidden email]>> wrote:

Just tested in 8.1.1 RC 2: Two stacks open, one stack is the topStack and is the defaultStack.

Setting that stack’s visible to false keeps it as the defaultStack and the topStack.

Peter Bogdanoff

On Oct 14, 2016, at 1:37 PM, Bob Sneidar <[hidden email]<mailto:[hidden email]>> wrote:

Wait what? It has to be visible? THAT I did NOT know. So hiding a stack will make it NOT the defaultStack if another visible stack is open.

Bob S


On Oct 8, 2016, at 13:22 , Richard Gaskin <[hidden email]<mailto:[hidden email]><mailto:[hidden email]>> wrote:

The rule Dr. Raney gave me is that the defaultStack is the topmost visible stack of the lowest mode.

_______________________________________________
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: Understanding 'the defaultStack'

Richard Gaskin
Bob Sneidar wrote:

 >> On Oct 8, 2016, at 13:22 , Richard Gaskin wrote:
 >>> The rule Dr. Raney gave me is that the defaultStack is the topmost
 >>> visible stack of the lowest mode.
 >>
 >> On Oct 14, 2016, at 14:21 , Peter Bogdanoff wrote:
 >> Just tested in 8.1.1 RC 2: Two stacks open, one stack is the
 >> topStack and is the defaultStack.
 >>
 >> Setting that stack’s visible to false keeps it as the defaultStack
 >> and the topStack.
 >
 >
 > That breaks Dr. Raney's rule.

It's been nearly two decades since I had that conversation with Dr.
Raney.  As I noted earlier, and as Jacque and Peter confirm, it's likely
I was just mistaken - it seems the actual rule is even simpler:

   The defaultStack is the topmost stack with the lowest mode.


 > I'm not sure who I am anymore...

Unless you've experienced a problem with it, just keep doing what you're
doing.  It seems to be working as expected for most people in most
circumstances.  We have more posts here exploring its definition than
about problems relating to its behavior.

--
  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: Understanding 'the defaultStack'

J. Landman Gay
On 10/15/16 9:53 AM, Richard Gaskin wrote:
> We have more posts here exploring its definition than about problems
> relating to its behavior.

The discussion was very helpful for me, I've never been clear about when
I need to specifically set the defaultstack, and usually I only figure
it out when errors happen. Then I'd set it specifically, still never
understanding why I had to.

I do use the defaultstack whenever I have many actions that need to
apply to a stack. If I'm only referring to an object once or twice I use
a long ID or name, but if I need to do lots of stuff it's way easier to
have a defaultstack.

One good example is the stack-builder tool I wrote for a client, which
creates and updates stacks. During creation there are hundreds of
commands to create objects, apply scripts and properties, import images,
etc. Using long references in every line of that code would be burdensome.

Until now I couldn't understand why "create stack x" required me to set
the defaultstack to the newly created one. Now I do.

--
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: Understanding 'the defaultStack'

pmbrig
In reply to this post by Richard Gaskin

> On Oct 15, 2016, at 10:53 AM, Richard Gaskin <[hidden email]> wrote:
>
> Bob Sneidar wrote:
>
> ….
> > I'm not sure who I am anymore...
>
> Unless you've experienced a problem with it, just keep doing what you're doing….

Be yourself -- everyone else is already taken. -- Oscar Wilde

— Peter

Peter M. Brigham
[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
123