Hacker News new | past | comments | ask | show | jobs | submit | bo-tato's comments login

there's a much faster regex library: https://github.com/telekons/one-more-re-nightmare


It's not yet operational, sadly. Missing ^ and $ isn't a small thing.


The main thing I like is basically you always have a debugger present. When you run into some issue you don't have to restart your program in a debugger and recreate it. Even running in production you can remotely connect to your program and inspect everything about it. Another thing about this is that when exceptions happen you're dropped in the debugger before the stack is unwound, and you generally have options to recover and continue execution without restarting everything and losing your state, which imo is the only sane choice for a dynamic language where you know you will be getting some type errors at runtime in development at least. Everyone knows the frustration of starting some python script, having it run for 10 minutes only to have it crash on some exception that you have to fix and restart. Also I'm not entirely sure why, I think because CL does more checks at compile time, and there is more type checking, I tend to get fewer runtime errors and they're closer to the source of the problem and easier to debug than in other dynamic languages. Then there are questions like what happens to existing instances of classes when you add fields or otherwise change them, which CL handles (https://malisper.me/debugging-lisp-part-3-redefining-classes...), but other language REPLs don't.

Regarding the syntax of those type declarations, it's true I also thought CL was verbose and ugly at first, but it is also extremely flexible through macros and reader macros. At the end of the day I think it's easier to improve that in CL that it is to make other languages support the interactive development of CL which requires fundamentally rewriting the language runtime. For those type declarations specifically, there is serapeum which is a extremely commonly used library, that provides -> for more ergonomic type declarations, ie:

  (declaim (ftype (function (string string) string) concat))
would become: (-> concat (string string) string) there is also https://github.com/lisp-maintainers/defstar for providing more ergonomic type declarations inline in definitions

And this is another thing I'm not sure how to explain, I thought CL is surely more verbose and ugly than python for small scripts, but maybe it's macros will make it cleaner for building large systems. But then when I started writing actual programs, even small programs without any of my own macros, I generally use about 30% less LoC than in python... I've thought about making sly/slime like support for python (built on ipython with autoreload extension) or ruby (with it's fairly new low-overhead debug gem). But at the end of the day support for these things will always be incomplete and a hack compared to CL where it was designed from the start to support it, they run 20-100x slower than CL, and imo their runtime metaprogramming is harder to reason about than CL which is mostly compile time metaprogramming. When I've had to dig into some CL library, which is a lot more often than in those languages because it has 10000x fewer users so of course I will be first to run into some issue, it has generally been easy to understand what is going on and fix it, compared to large codebases in other languages.

Regarding "modern type-safe language", languages with expressive type systems, rust, ocaml, haskell, typescript, etc, can give really confusing type errors, when you get into generics and traits and more expressive stuff. I'm not convinced it's a better development experience than a dynamically typed languages where values have simple types, and when you get a type error you see the actual contents of the variable that is the wrong type and state of the program, at least in the case of CL where the stack isn't unwound on error and runtime is kind of compile-time as you're running all code as you write it. But mostly this sort of interactive development is very hard to implement in static languages, I'm not aware of any that does it. For example even in static langs like ocaml that have a repl through a bytecode interpreter, simple things don't work like say you pass some function as an event handler, and then update the function. As you passed efectively a function pointer to the old definition, rather than a symbol name like lisp, it will be calling the original function not the new version. But the main issue is that efficient staticly typed languages the type system is all at compile time, type information doesn't exist at runtime, which is great for performance, but means you don't get the ability to introspect on your running program like you do in CL and elixir, which personally I value more than full compile-time type checking.

Would I like some new language or heavy modification of existing language runtime that provides the best of everything? of course, but I also realize that it's a huge amount of work and won't happen with 10 years, while I can have a nice experience hacking away in CL and emacs right now. And ultimately CL is an extremely flexible language and I think it'll be less work to build on CL than to provide a CL like runtime for some other language. For example projects really pushing the edge there is Coalton described above. While personally I prefer dynamicly typed for general application programming I think Coalton could be great for compilers, parsing some protocol, or writing some subparts of your program in. And vernacular (https://github.com/ruricolist/vernacular) which explores bringing racket's lang and macro system to CL. For more standard CL code, using extremely common and widely used libraries like alexandria, serapeum, trivia, etc, already makes CL into a fairly modern and ergonomic language to write.

Edit: also about the lack of line numbers in the compiler message, it's funny I never noticed that and I'm not sure how exactly emacs does it, but for those compiler warnings about types emacs underlines in red not just the line but the exact expression within the line and you can press a shortcut to go to the next and previous compiler warning/error/note. For better or worse emacs is the de facto free development environment for CL (lispworks and allegro are the commercial ones still maintained), though in recent years there are plugins for VSCode and most major editors, I haven't tried them and am not sure how they compare.


Thank you for the really detailed and thorough comment! I appreciate it.


And why I love doom emacs, it's almost like vscode in ease of getting set up for different languages. There's a init.el file with a :lang section where you can uncomment languages to enable them. Support for sh is enabled by default, and if shellcheck is installed it will use it without you having to customize anything. It's all the hackability of emacs when you want, but also just good defaults so everyone doesn't have to spend time configuring the same basic functionality.


I personally find that configuring vanilla emacs isn’t that scary. evil-mode + evil-collection provide most of the hard part of these distributions and I’ve found that growing from a minimal setup makes it easier to maintain your configuration than building on top of doom or spacemacs


Doom Emacs is minimal. You can configure it in pretty much the same way as vanilla Emacs without it getting in the way. I never felt my configuration was harder to maintain because of Doom. There are also modules you can enable that brings in a lot of packages, but they're purely optional. Personally, I find those modules to be sane and helpful.

Also, adding evil mode won't address half of my requirements for a baseline Emacs experience. There are performance optimizations in Doom that I wouldn't otherwise have known to put in my own configuration. I'm grateful there are people who are taking care of such details for users like me.

Normally, I avoid configuration frameworks. I don't use them in tmux, vim, or zsh. But Doom was the first configuration framework that I enjoyed using.


My configuration is 3k lines of lisp code (measured by cloc). Doom is about 44k. So, Doom's configuration is about 12 times large than mine and my configuration works for just about everything I need. Adding support for a new language is typically mostly figuring out how to get a language server and configuring eglot for it, then installing syntax-highlighting either via tree-sitter or with (use-package <language>-mode :ensure t). Addtitionally, just skimming doom's early-init.el[1], it makes a lot of questionable choices (like requiring the use of `doom sync` for stuff emacs just does by itself).

[1]: https://github.com/doomemacs/doomemacs/blob/master/early-ini...


That LOC comparison doesn't make sense. It's 44k lines only if you enable every optional module, which no one ever does. On top of that, you're penalizing Doom for having better documentation by counting docstrings. Docstrings account for a large portion of Doom Emacs code.

Also, there are loads of people who need the things you found questionable or unnecessary. Including myself. I use modules for purposes other than adding support for new languages. But for language support, I sometimes need much more than just the first language server and syntax files that came up in a search result. The performance optimization you found questionable is an absolute must, too. Running "doom sync" to apply changes to configuration is a non-issue if that means faster startup.


I'd love doom emacs if it was an opinionated distro. Supporting competing alternatives for many packages means targeting a common denominator, and having a more buggy and fragile product than it has a right to be.

So the advantage of having someone else optimise a config is lost because most effort is spent supporting tons of optional packages. Meanwhile my hand written config is the definition of opinionated.


What's so hard about adding 5 lines to a config file? You're adding 100s of customizations that slow down emacs when you probably use a handful of them at most.


> You're adding 100s of customizations that slow down emacs

Doom Emacs' config loads faster than my hand-rolled one did.

So in that sense, with Doom I get a smaller config to maintain, for something that loads faster, while still having a rich/coherent set of features for the stuff I do bump into.


> Doom Emacs' config loads faster than my hand-rolled one did.

Having browsed the Doom config sources the other day, they put a lot of effort to minimize startup time; there are various trick there that tune Emacs itself to start faster, and can be copied over to one's own vanilla config :).


Sometimes packages don’t come with sane defaults. Or something conflicts somewhere. Im tempted to plunder doom config, but I suspect it’s not straight forward.


It's not bad actually, I have plundered a number of things from Doom


The experience with distributions like Spacemacs, doom emacs or lazynvim really isn't that much worse than vscode, you select the language you want to code, it installs a reasonable set of plugins and you get to work.


configuring vanilla emacs from scratch is certainly a lot of work. There's various distributions (Doom emacs, Spacemacs) that while not perfect have a pretty decent 'new user' experience without too much work. I don't use Go too much but I've done some projects in it. I just uncommented (go +lsp) in Doom's init.el, ran doom sync, restart emacs, and everything just worked, I didn't feel that need to configure anything further.


You are loading code you wrote, not evaling untrusted user input. Common Lisp is actually safer than a lot of languages in that Java, Python, Javascript, etc all do lots of runtime reflection and metaprogramming that leads to vulnerabilities where lisp metaprogramming is happening at compile time and therefore a lot safer.


If you're just using it for quick scripting, which is where startup time mostly matters, and you only use the stdlib and no external gems, you can use --disable-gems and it starts in half the time as python for me.


Hey, you're right. Down from 100ms to 30ms which is 10ms faster than Python. So it's game over for Python, not Ruby, after all ;-)


In the annual lisp game jam it seems a lot of the submissions and the most polished ones are using fennel, which is a lisp that compiles to lua from the same creator of Janet. Then for lua (and fennel) there is high quality game engines LÖVE (2d games), TIC-80 (retro 2d), LÖVR (3d).


easiest solution I found was building SBCL targetting an old glibc using zig as the c compiler:

CC="zig cc -target x86_64-linux-gnu.2.28" LD="zig cc -target x86_64-linux-gnu.2.28"

zig bundles in all the glibc headers, so I think it should build on musl libc-based distro

for more complicated programs with native dependencies there is (https://github.com/Shinmera/deploy) or guix has a lot of CL libraries already and it's fairly easy to write packages for others, you can specify all dependencies with guix and use guix pack to get a .tar with all dependencies you can unpack and run on any other linux box


I was wondering if compiling via Zig would work. Also, thanks for the Guix tip—I will give that a try!

I think native dependencies would require something like this (which I believe uses Deploy to solve part of the problem): https://www.timmons.dev/posts/static-executables-with-sbcl.h...


It seems with the massive amounts of money and full time engineers JVM has to be far more advanced technically, but does it actually make a difference? I don't know anything about compilers I just know LuaJIT is faster than any dynamic language on the JVM, SBCL is much faster than lisp on the JVM, chez scheme is much faster then scheme on the JVM, pypy is faster than jython. For statically-typed GC languages that should be comparable to Java, Go and Ocaml are famous for having very simple and fast compilers (fast as in they compile quickly without doing much optimization) and they don't perform any worse than Java.


Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: