Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

[WIP] Let In Syntax Initial Impl#578

Draft
oldwomanjosiah wants to merge7 commits intoelkowar:master
base:master
Choose a base branch
Loading
fromoldwomanjosiah:josiah/add_let_in

Conversation

oldwomanjosiah
Copy link
Contributor

@oldwomanjosiaholdwomanjosiah commentedSep 19, 2022
edited
Loading

Description

This is not intended to be final, but I had some time so I thought I would work on this. First pass ended up being easier than I was expecting.

Usage

(defvar somevar {{ "key": "Some Value" }})(label  :text { let it = somevar.value in "Here Is ${it}" end })

Showcase

My current workspace indicator:

image

Where I have a script that outputs the following on workspace changes:

{"1": {"dis":-1,"ex":false,"urg":false  },...}

And the let-in syntax to pull out the relevant information for each part

(defwidget workspaceIndicator [num monitor]  (box :orientation"v"    (button      :class {let          ws= active_workspaces["${num}"],          foc= ws.dis== monitor ?" focused" :"",          vis= ws.dis>=0 ?" visible" :"",          ex= ws.ex ?" exists" :""in"indicator"+ foc+ vis+ ex        end      }      :onclick"scripts/workspaces set ${num}"      (box :orientation"v"        (box :orientation"h"          (box :class "inner"))))))

Diffs containing fuller example of usage

Additional Notes

I borrowed the testing macro from#577

Checklist

Please make sure you can check all the boxes that apply to this PR.

  • All widgets I've added are correctly documented.
  • I added my changes to CHANGELOG.md, if appropriate.
  • The documentation in thedocs/content/main directory has been adjusted to reflect my changes.
  • I usedcargo fmt to automatically format all code before committing

devgioele and FlashLight13 reacted with rocket emoji
@oldwomanjosiaholdwomanjosiah changed the titleAdd Let In Syntax[DRAFT] Let In Syntax Initial ImplSep 19, 2022
@@ -91,6 +91,9 @@ impl SimplExpr {
.collect::<Result<_, _>>()?,
),
x @ Literal(..) => x,
LetIn(_, d, b) => {
todo!("Resolve Refs is unused, TODO(josiah)");
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

It's unclear to me atm what should be done here. As far as I can tell the function is (transitively) unused, and could be removed, so it might not be a problem.

It might make the most sense to use the values from the let block to map the inner vars, but the variable defs haven't been evaluated yet here.

@oldwomanjosiaholdwomanjosiah changed the title[DRAFT] Let In Syntax Initial Impl[WIP] Let In Syntax Initial ImplSep 19, 2022
@oldwomanjosiah
Copy link
ContributorAuthor

@elkowar Just following up here to see if you have any feedback on the direction of this? Specifically iftry_map_var_refs can/should be removed, or if not what the behavior there should be, but also in general.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

1 participant
@oldwomanjosiah

[8]ページ先頭

©2009-2025 Movatter.jp