Skip to content
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

async-let does not expand to let* (and maybe it needs to) #140

Open
FelipeLema opened this issue Jan 20, 2021 · 0 comments
Open

async-let does not expand to let* (and maybe it needs to) #140

FelipeLema opened this issue Jan 20, 2021 · 0 comments

Comments

@FelipeLema
Copy link

FelipeLema commented Jan 20, 2021

Hey, there

I don't know if I'm misunderstanding what the intention of async-let is. If I understand correctly, it's missing an implicit feature from let* in that every binding inherits the bindings before it.

The following example summarizes my current problem:

(async-let ((default-directory "/")
            (pwd (shell-command-to-string "pwd")))
  (message "%s" pwd)) ;; prints my current directory, instead of "/"

From what I understand from the implementation, each binding is expanded to

`(async-start ,ith-binding-form
              (lambda (,ith-bindng-name)
                ,rest-of-bindings
                ))

Whereas I would expand it into something among these lines

`(async-start ,ith-binding-form
              (lambda (ith-binding-value)
                (let (
                      ,resolved-previous-bindings
                      (,ith-binding-name ith-binding-value))
                  ,rest-of-bindings-or-forms)))

I believe this would resolve the example problem I listed. I haven't supplied an explicit fix for this problem because I don't know if we should fix current async-let or have a separate macro like async-expanding-let* instead.

BTW, this is a great package. I depend on it for my everyday work.

@FelipeLema FelipeLema changed the title async-let does not expand to let (and maybe it needs to) async-let does not expand to let* (and maybe it needs to) Jan 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant