Procedure call scopes #4918
keenanwoodall
started this conversation in
Ideas/Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Issue: #4917
Managing "scopes" when declaring ui layouts can get a bit hairy.
Given an api where you can
open()
andclose()
ui elements, you have two options:open()
andclose()
@(deferred_out)
I don't think anything is inherently wrong with either, but it can start to feel a bit verbose.
Currently, opening a scope immediately after a function call is not legal syntax
Describe the solution you'd like
Allow a scope to be opened after a function call when the proc has a
@(deferred_x)
attribute, or if necessary a new attribute, say@(scoped_x=)
This would behave like
defer
, but would defer to the end of the scope associated with the function call, calling the deferred proc immediately if no scope is present.This would allow the UI in my example scenario to be defined like so:
This is very much just a "nice to have", but I totally understand if it would conflict with Odin's principles and introduce too much "magic"/ambiguity. Maybe there's a better way to go about it, I just wanted to throw out the idea as it would make writing ui of in this way feel a bit smoother and remove some of the "noise"
Beta Was this translation helpful? Give feedback.
All reactions