Repository navigation
feat: compile h/expr with squint core semantics (#48) - #49
Merged
Merged
Conversation
Contributor
|
Looks great! A few small asks:
|
Contributor
Author
|
Done |
Contributor
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #48.
h/exprnow compiles against squint core, which hyper serves as thehyper_scglobal at/hyper/squint-core.js.User-visible changes:
0and""are truthy inand,or,if,whenand the*-letforms.=compares by value (hyper_sc._EQ_), with a plain===against literals.strrendersnilas"".&&and||compile to the JS operators.printlnis squint's. Usejs/console.logfor raw console output.Datastar puts its
returnafter the last;in a value attribute, even one inside a nested function (starfederation/datastar#1215). Squint emits such functions forletin expression position. When compiled output contains a;, h/expr now returns the last form through a variable:var __hyper_r = (...); return __hyper_r;. A division followed by a/in a later string or regex still breaks in Datastar and is tracked in the same issue.Also:
set!in parentheses in expressions.=,strandprintlnrewrites and the compiler macros that were never reached.Tests: unit and e2e pass.
expr-nested-testruns a nestedwhen-letoverorand are-findof#"a;b"in the browser.Follow-up: borkdude/hyper@squint...expr-bundle serves only the squint core functions that h/expr output uses, built with esbuild on request
(208 bytes gzipped instead of 33 KB for the e2e suite).