Skip to content

Shared user properties #107

Description

@uliwitness

A lot of shared information was traditionally kept in globals in HyperTalk. In modern languages, there are many smaller scopes that you can use to avoid namespace collisions between different modules. We already have user properties as a storage that is namespaced to that instance. (a property "foo" on cd btn 1 can be completely different than one of the same name on cd btn 2)

It seems like it could be a good first step to add something like that to user properties. To provide some sort of "shared" user property that can be addressed just like any other user property, but whose value is shared by multiple objects.

Can we find a good syntax for that? Or is it enough to just tell scripters to create an invisible object to hold all those properties and access them from another?

Maybe something like

create cd btn "sharedStorage"
define property "shared1" of cd btn "sharedStorage"

create cd btn "storageAccessor1"
set sharedPropertyContainer of cd btn "storageAccessor1" to cd btn "sharedStorage"
set shared1 of cd btn "storageAccessor1" to 42 -- actually changes shared1 of cd btn "sharedStorage"

?

One major advantage of this would be the brevity of saying my shared1 inside "storageAccessor1"'s script instead of having to write shared1 of cd btn "sharedStorage". Of course it could also be surprising if there was a "storageAccessor2" whose shared1 property would suddenly also change.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions