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
Add `-defun' #347
Open
nbfalcon
wants to merge
32
commits into
magnars:master
Choose a base branch
from
nbfalcon:feature/-defun
base: master
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add `-defun' #347
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
f3f29e3
Add `-defun'
nbfalcon 6add372
`-defun': add declare with doc-string and indent
nbfalcon 3a63e45
Add examples for `-defun'
nbfalcon 727df5c
`-defun', `-lambda': support &optional and &rest
nbfalcon 379e48c
Fix `-defun' &rest example
nbfalcon 24850aa
`-lambda': support declare-forms; add `-defmacro'
nbfalcon 2e989aa
Improve docstrings
nbfalcon 03186e0
Fix edebug specs
nbfalcon 6a87bae
Optimize &as bindings
nbfalcon 95462fc
`-defun', ...: allow vectors as MATCH-FORMs
nbfalcon c4ffe96
`-defun', ...: optimize &as bindings in vectors
nbfalcon 6f2626f
`-lambda', ...: improve debug specs
nbfalcon bcfd26a
Fix byte-compile error(s)
nbfalcon fd53121
`-defmacro': add example
nbfalcon 92e623f
`dash--destructure-body': optimize: use `-let*'
nbfalcon 23749b3
`dash--destructure-arglist': docstring generation
nbfalcon 6afe446
Fix edebug specs: debugging `-defun'
nbfalcon 376acdb
`-defun', ...: improve error handling
nbfalcon 34d618b
`dash--arg-list-keywords': improve docstring
nbfalcon 79a71d6
`-lambda': don't interpret `declare'
nbfalcon 30a0de5
`dash-lamba-list': remove TODO
nbfalcon e0fb5d5
`-defun', ...: use `make-symbol'
nbfalcon 2f9fc8c
`dash--as-matcher?': destructure directly
nbfalcon 148a833
`dash--as-matcher?': [x &as] is not an as-matcher
nbfalcon 83a3c12
`dash--match': refactor: use `dash--as-matcher?'
nbfalcon bcc9763
`dash--destructure-body': DOC -> ARGLIST
nbfalcon caf7445
`dash--decompose-defun-body': drop DECLARE?
nbfalcon 7895a2b
`-defun', .... reduce code duplication
nbfalcon 9ac1487
Drop `dash--docstring-add-signature'
nbfalcon d8cab22
`dash--decompose-defun-body': behave like `defun'
nbfalcon 8ac91de
Fix square-bracket arguments
nbfalcon 66f513e
Improve examples
nbfalcon File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note the
-let
: previously,-let*
was used instead, which might be more efficient as the latter is implemented in terms of the latter. Not doing that might also make my various symbol and &as optimizations for naught. What do you think?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think I can say something intelligent on this, as I have not yet looked at the code closely.
But re:
-let
being implemented in terms of-let*
- I think that's an implementation detail that we should not base other design decisions on, since-let
should ideally be implemented only in terms of itself.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to make sure that input arguments are evaluated in parallel, whether with
-let
or-let*
doesn't matter much.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That wouldn't really affect the design -
-let
and-let*
can both be used in this position. However, currently-let*
is more efficient (both in terms of macro-expansion and less bytecode)::Evaluating the arguments in parallel or not doesn't make a difference here, as all binder-expressions don't reference any previously defined variables.
The trade off here is slightly better readability vs efficiency -
-let
makes it obvious that this won't be referring to variables defined earlier, but-let*
is more efficient, currently.Perhaps
-let
should be optimized more instead?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You would need to construct some kind of graph of dependencies between the bindings. Which I suppose was too much work and I simply leveraged the built-in let to handle it for me. But yes this is a possible optimization. In practice probably insignificant :) But it could be intelectually stimulating :D
You're right about the lambda, there the parallel eval is handled by the runtime when the arguments are passed to the "wrapper lambda".