0

I wrote a piece of code using if-let. Later, when I tried to use my function, I got:

Symbol’s function definition is void: if-let

So I found that if-let is defined in subr-x.el and I need to use (require 'subr-x) in my code.

My question is: Is using if-let discouraged in emacs-lisp?

3
  • 3
    it is defined in subr.el; v29.1
    – shynur
    Nov 23, 2023 at 14:16
  • "Discouraged" how? By whom? Why do you ask? The question seems to encourage opinion-based answers.
    – Drew
    Nov 23, 2023 at 17:13
  • Oh, no. Sorry! It was not my intention. It's just that I recently discovered if-let and it seemed strange, to me, that in my Emacs (26.3) it is necessary to use (require 'subr-x). I had doubts that using if-let wasn't good practice. Nov 24, 2023 at 20:47

1 Answer 1

2

It's not discouraged for users. However, if-let is in subr-x because that's not pre-loaded into Emacs before dumping, unlike subr, and the Emacs devs want to limit unneeded bloat in the base image. if-let is after all some pretty trivial syntactic sugar over if and let.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.