Array literals and script only stack initialization (was Re: Developing first on android)

Brian Milby brian at milby7.com
Mon Aug 21 12:09:41 EDT 2017


What about something like
  import into [objectRef] from array [arrayRef]
    OR
  update [objectRef] from array [arrayRef]
where the array would be in the format of the export and the object would
be an existing object.

I've been looking at the code and think that it would be straightforward to
take the save/load code and change it over to creating an array.  Some of
the complexity would go away since key existence could be checked directly
instead of flags for example (on import mainly).  All of the code specific
to versions < 9 would not be needed.  It would start with the MCObject and
be needed everywhere else.  The existing import/export code would then need
to call appropriate handlers to take care of the object info if the key
existed ([$object] as a suggestion).

If the full specification of the object is in the export array, then the
import could re-create an exact duplicate.  There would need to be a check
on the ID and altID to ensure a duplicate isn't being created (with
appropriate/sensible handling of collisions).  The import would be fully
backwards compatible since if the object key is not present, then it would
just work like it did before.

The suggestions about support for inline arrays would actually make this
interesting too.  A single statement could be used to update multiple
values/properties/settings of an object at once.  I'm sure there are pretty
big gotchas on that though since it would likely avoid proper messages from
being dispatched (or the update could dispatch messages as updates
performed or collect the messages that should be sent and dispatch them
sequentially after all updates were completed to avoid duplicates).  I
haven't gotten that far in research yet, so not sure.

Thanks,
Brian

On Mon, Aug 21, 2017 at 4:58 AM, Mark Waddingham via use-livecode <
use-livecode at lists.runrev.com> wrote:

> Indeed, if we had a better 'properties' property (i.e. as suggested by me
> in terms of import/export array - something allowing you to get/set the
> core persistent state of an object directly) then you could have
> script-only-stacks which *also* contain their state (and, by collorary,
> state of objects on the stack) - via having code which does it.
>
> Warmest Regards,
>
> Mark.
>
> --
> Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
> LiveCode: Everyone can create apps
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list