Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support push of single dict fields #79

Merged
merged 7 commits into from
Dec 21, 2021
Merged

support push of single dict fields #79

merged 7 commits into from
Dec 21, 2021

Conversation

hhaensel
Copy link
Member

This PR is the basis for pushing single fields of dictionaries and possibly array elements in the future.
I cleaned up the push!(model::M) methods for this purpose.

@hhaensel hhaensel marked this pull request as ready for review December 20, 2021 00:05
@hhaensel
Copy link
Member Author

The current version now handles dicts and arrays

@hhaensel hhaensel merged commit d48dc14 into master Dec 21, 2021
@hhaensel
Copy link
Member Author

on() routines for array or dict fields that are expected to support direct element access should now be defined as

on(model.dict) do dict, _...
    # do something with dict
end 

or

on(model.dict) do dict, options...
    # do something with dict and options
    if isempty(options)
        # do the standard thing
    else
        v, jskeys = options[1:2]
        # do something with the changed value
end 

In the future this will probably change to rather return the object and the julia index (x, nestedkeys = options[1:2] or unnested = options[1]). That way we will be compatible if ever we move this interface to Observables.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant