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

[FEATURE] widget-local state #324

Open
elkowar opened this issue Oct 25, 2021 · 1 comment
Open

[FEATURE] widget-local state #324

elkowar opened this issue Oct 25, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@elkowar
Copy link
Owner

elkowar commented Oct 25, 2021

To anyone desperately waiting for this: I am, too, but it's still gonna take some time, as a large statemanagement rework is first required, that has already cost me a lot of braincells...

In the future, it should be possible to have variables be local to a widget. This would allow for reusable widgets to have their own, isolated state, making it significantly easier to implement generic, dynamic UI elements.
For this, a couple of things are necessary.
First and foremost, the already planned statemanagement rework needs to take place, to make this possible.
Secondly, Syntax for defining and updating local variables needs to be defined and implemented. Here we could either go with a classic let Syntax, as is popular in most lisps, or have a special variables block of some kind.

(defwidget foo []
  (locals [(defvar something "default")]
    (button :onclick (set something "new value")
      "click me"))) 

the way to update these would most likely be adding a set Form as a valid value for onclick and similar attributes.
For consistency, shell commands should then maybe also fall under a (shell notify-send foo)` Syntax, although that would be a breaking change.

Its also not yet clear if locals should also allow for script vars.

@Lazerbeak12345
Copy link

Lazerbeak12345 commented Jun 2, 2022

(comment moved to #453 (comment))

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

No branches or pull requests

2 participants