-
Notifications
You must be signed in to change notification settings - Fork 13
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
merge objects and envs into scopes #2
Merged
Conversation
This file contains 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
* phase 1 of unifying with Object * next phase is to remove Object and turn {} into Env literal * the plan: {} takes a sequence of parent scopes followed by alternating binding value pairs, e.g. {p1 p2 :a 1 :b 2} * create a child scope: {parent} Signed-off-by: Alex Suraci <[email protected]>
{parent :a 1 :b 2} constructs a scope inheriting from parent, with a bound to 1 and b bound to 2 * applicative; all contents are evaluated in the calling scope * parent scopes may be listed anywhere (typically beginning I guess) * keywords followed by values set bindings in the child scope
this is all kind of one big bang, but all the tests pass. docs sitll need to be updated.
* :foo evaluates to foo (symbol) * remove keyword? and keyword constructors/converters * move keyword operative semantics to symbols
Resolved issues in the following files via DeepSource Autofix: 1. applicative.go 2. bool.go 3. builtin.go 4. continuation.go 5. empty.go 6. fspath.go 7. host_path.go 8. ignore.go 9. int.go 10. keyword.go 11. null.go 12. operative.go 13. path.go 14. pipes.go 15. reader.go 16. scope.go 17. string.go 18. suite_test.go 19. symbol.go 20. value.go 21. workload_path.go
* no shrunken text * giant (parens) (simulated with a border) * fix false positive for rendering workload path as workload instead
just fudging the numbers tbh, this was kind of annoyingly frequent for fast local iteration. an hourly/daily cycle seems good enough for picking up changes gradually. set it lower when needed.
.Clone could be confused with a prototype-style child scope, when in reality it performs a deep copy including all parent bindings, resulting in an independent but equivalent value
* bassics page now generates tags and anchors * flattened bassics page into a more clear glossary * render scopes + parent scopes, rather than objects * rename object to scope everywhere
too sacreligious
useful for profiling
use cheaper direct type checking instead to avoid allocs, since these values should never be annotated anyway (knock on wood)
another hot code path which should be able to trust the return values a bit more
these get allocated on basically every turn, so let's re-use them
embed.FS paths Stringify terribly
since most throwaway scopes won't have any also simplify Bind implementation; clear out parents instead of making two scopes
vito
added a commit
that referenced
this pull request
Feb 20, 2022
merge objects and envs into scopes
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.
This is a bit of a doozy. The commit messages don't really help. Most of the
rationalization can be found in Roam.
tldr: I kept noticing the symmetry between Keywords, Symbols, Objects, and
Envs, so I wanted to see if that could be consolidated. Turns out it's doable,
and has pretty (imo) interesting results.
The delta:
{parent :a 1 :b 2}
constructs a Scope[:foo]
evaluates to(foo)
Interesting outcomes:
functions
part of the core language semantics
as Atomo - but in a functional language, instead of prototype-based OOP
[] : () :: :foo : foo
(let)
could be implemented using{}
for thebindings
TODO:
usetoo sacreligious{}
for(let)