help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: let*: Wrong type argument: stringp, nil


From: Hongyi Zhao
Subject: Re: let*: Wrong type argument: stringp, nil
Date: Wed, 29 Sep 2021 14:17:02 +0800

On Wed, Sep 29, 2021 at 12:35 PM Emanuel Berg via Users list for the
GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:
>
> Hongyi Zhao wrote:
>
> > (defun try/pyvenv-workon ()
> >   (when (locate-dominating-file (buffer-file-name) ".python-version")
> >       
> > ;https://emacs.stackexchange.com/questions/9474/let-statement-throws-error-on-assigning-a-form-to-a-variable
> >       (let ((file (concat (locate-dominating-file (buffer-file-name)
> > ".python-version") ".python-version")))
> >            (pyvenv-workon (with-temp-buffer
> >                            (insert-file-contents file)
> >                              (nth 0 (split-string (buffer-string))))))))
> >
> > BTW, should I use `let' or `let*' here?
>
> `let*' always works, `let' works when there is no references
> to previous bindings in any binding...
>
> So if it works and you have let, you have done the
> right thing!
>
> In theory, because of the independence of the individual
> bindings with let, it can be used to compute in parallel - but
> I don't think that actually happens - an urban legend ...
>
> In your code you only have "file" so while both would work,
> let* is unnecessary ...

Wonderful explanation. Got it. Thank you very much again.

HZ



reply via email to

[Prev in Thread] Current Thread [Next in Thread]