5 ms·
I'd wager there are a fair number of us that are quite glad not to have python as the main language. I am curious if there are specific things about elisp that
by taeric 8y ago
I'd wager there are a fair number of us that are quite glad not to have python as the main language.
I am curious if there are specific things about elisp that you dislike.
- m463 8y agoI do not want to throw away emacs, I just think a python port would be enjoyable, for me. I find python very expressive. When I work in elisp, I seem to find it cumbersome to do many of the mundane things, like using a local variable, and if/then/else with multiple statments, loops (continue? break?), oo stuff, etc. a contrived example: (let ((foo)) (if cond (progn (setq foo 10) (bar)) (progn (setq foo 20) (baz)))) if cond: foo = 10 bar() else: foo = 20 baz() To be clear, yes, I know how to do these things, and I've written elisp for many years. Everything I can do in python, I can also do in lisp. It's just that python seems to read and write easily for me.
- tincholio 8y agoYour example is not necessarily contrived, but it is not very representative, either. Throw in a couple of proper lambdas in there, and suddenly python won't look as nice.
- m463 8y agoI do stuff like this all the time: mysorted = sorted(mydict, key=lambda t: t['Price']) but generally I write out functions in python.
- testcross 8y agoThis isn't the sortest elisp equivalent, no? I'm not a pro, but this should do the same thing for example. (if cond (progn (setq foo 10) (bar)) (setq foo 20) (baz))
- TeMPOraL 8y ago> When I work in elisp, I seem to find it cumbersome to do many of the mundane things, like using a local variable, and if/then/else with multiple statments, loops (continue? break?), oo stuff, etc. That's, frankly, because you don't know the language. It doesn't take much to learn it, though, and lisps tend to be similar, so you'll learn a bit of CL and Clojure at the same time :). I would similarly struggle with Python, for a short while at least, if you sat me in front of PythonMacs. Your example could be rewritten as: (let (foo) (cond (condition (setq foo 10) (bar)) (t (setq foo 20) (baz)))) ... which already looks like Python code, except supports arbitrary number of branches (cond is if/else if/else). Lisp has a slightly different style of writing than in Python, which yields comparably tight and readable code... and then you can use macros, which Python doesn't have, dynamic binding, which Python doesn't have either (and while a pain most of the time, they're a life-saver in some cases, and the type of code you write for a text editor has lots of those). Elisp isn't a bad language. It can handle all the stuff Python does and then some. I get the preference for syntax you're already familiar with, but individually, it might be worth it to just bite the bullet and learn some new syntax. If that's your first exposure to Lisp, then it'll be especially rewarding, for all the "code is data is code" and "code that writes code that writes code" enlightenment that comes with it.
- m463 8y agoYou are correct when you say "Lisp has a slightly different style of writing than in Python" Maybe I was trying too hard to use "if" as common ground in my contrived example. I generally use if for simple conditions and cond for multiple conditions (python would use elif, and has no case statement). But in the same vein, your example doesn't look like python, at all :) The point of my comment is not to put down elisp, but instead to say that the translation of ideas in my head to working code seems to go smoother for me using python than lisp, both reading and writing.
- taeric 8y agoFair, "different strokes" and all of that. I'm not going to try and argue you out of the opinion, since, well, we are free to disagree. :) Not surprisingly, I have not had to maintain large blocks of elisp. I have had to deal with chunks of python from folks, and I just can't find it a language that is pleasant. Certainly not stable. Though, I am probably tainted in the whole python 3 debacle.
- m463 8y agoI agree with your take on python 3. I think it created a lot of confusion. Maintaining someone else's code is always a challenge, no matter what the language. The only elisp I've maintained are my startup files, ~4000 lines. I will say that the emacs elisp/C code is really special because you're always a meta-. away from checking out every editor function.