[V4REV] again: why we have go by way of single stack ???
Robert Brenstein
rjb at robelko.com
Wed Jun 15 16:54:33 CDT 2005
>Hi Trevor,
>Hi Robert,
>
>Can you again (yes I fell stupid) explain me:
>
>* why our original way with 50 independent examples looks bad for you ?
>
>* why we need to put them all into single example ?
>
I don't recall the whole discussion that lead to this but I think the
major issue that started it was your wanting to use some shared
functions and windows. Part of it was also producing a distro that is
clean of cvs and other ancilliary files.
For us, having a list of examples, makes it also much easier to see
what is there and faster to hop from one to the other without having
to think which folder is where and which is with examples and which
are common things not to be used directly.
Overall, it is just a cleaner solution. It can look strange to you
being used to the myriad of C/C++ files in multitude of folders.
Globals have nothing to do with that. They function same whether you
have a single stackfile or multiple stackfiles, so splitting back
into single stacks will not solve any issues with globals. Remember
that closing an example stack does not automatically dispose of
globals. They persist unless you program to explicitly purge each of
them.
>Just we seat and watch on this monster example,
>We think about how to resole global vars,
>And we see only bad ways from our point of view. :-((
You don't need globals at all. Some examples define in excess of 20
globals and each example makes its own set. That will result is
severe pollution of global space. Not mentioning that the names you
use are not unique enough.
You guys seem to be making this more complicated than needed but
can't really blame you since you are not really using Revolution
regularly and understanding it properly.
>
>-------
>For example about global.
>
>Robert, you have suggest to have
>
> MainExample: gValArray[ "gSomeVar" ]
>
>All rest sub-stacks use it.
That was suggested early on to simply reduce the number of globals.
Later, I told you that your examples should use custom properties or
local (static) variables not proper globals. Converting to custom
properties is more work, so you may prefer to use locals. That will
incur the minimum changes in code.
global fld_bool -> local fld_bool
They may require, though, moving some code from buttons to card
level, but from I have seen, most examples already have most code in
card scripts.
>But should we allow open 2 substack-examples in the same time?
>If yes, then OPS, we need something as
>
> gValArray[ "gDbRef_Example1" ]
> gValArray[ "gDbRef_Example2" ]
> .... 50 times.
>
>Terrible and ugly.
>The same for each global! TableRef. CursorRef, ...
You can say
gValArray["ex1,dbref"]
gValArray["ex2,dbref"]
or just
gValArray["dbref1"]
gValArray["dbref2"]
Array keys can be short. But as I said, you are probably better of
using local variables. They retain values like globals but go away
automatically when the stack is closed. And there are no name
conflicts possible.
>
>--------------------
>If we allow only ONE example substack to be open, then okay, it is more
>simple.
>
>
>---------------
>Ivan says that now it is hard redo globals on stack properties,
>To many redo...
>
Being able to open one example at a time would be limiting, although
it is plausible. It does not solve the issue of globals, though,
except allowing you to reuse same key names. However, opening a
single example at a time is functional only when all examples are
substacks in the same stackfile. Otherwise, nothing stops users from
opening multiple ones, at least trying.
>--------------
>I still wonder, why have start develop this MAIN Example stack???
>
>I do not see any problems with having 50 examples.
> each example point to one _external_ shared stack,
> which have common methods.
>
>As I understand this works technically in Revolution,
>So why we have go by single stack way?
>Just I cannot remember strong reasons....
Yes, you can have a mainstack with common windows as substacks and
keeping individual example stacks separately. It will work if you
follow the same rules. The difference is only with where they are
physically. Logically, they still must function basically as
substacks of the main stack. Examples must know where exactly the
mainstack is and watch that they do not close Valentina behind the
back of another example. The listbox stack must also know where
exactly the examples are.
Robert
More information about the Valentina-beta
mailing list