14 ms·
Why Fennel?
- Graziano_M 2y agoFennel is nice. I converted my neovim config[1] to fennel and haven't looked back. [1]: https://github.com/Grazfather/dotfiles/blob/master/nvim/fnl/config.fnl https://github.com/Grazfather/dotfiles/blob/master/nvim/fnl/...
- qrobit 2y agoFennel is indeed nice and I rewrote my config in it too, but looked back ~2 years later and rewrote it again in Lua. I think Fennel for configuration is not justified and just adds complexity. Also the tools are not there: two existing language servers[1][2] can't compete with Sumneko's Lua language server[3] and they are fennel-exclusive and clueless about Lua code. I still like Fennel for writing more complicated code (my plugins: [4][5]) because of neat features like pattern matching and structural decomposition, both are surprisingly robust. [1]: https://git.sr.ht/~xerool/fennel-ls/ https://git.sr.ht/~xerool/fennel-ls/ [2]: https://github.com/rydesun/fennel-language-server https://github.com/rydesun/fennel-language-server [3]: https://github.com/LuaLS/lua-language-server https://github.com/LuaLS/lua-language-server [4]: https://gitlab.com/repetitivesin/16cm.nvim/-/tree/main https://gitlab.com/repetitivesin/16cm.nvim/-/tree/main [5]: https://gitlab.com/repetitivesin/madol.nvim https://gitlab.com/repetitivesin/madol.nvim
- no_wizard 2y agoI find most niche / less popular languages lack the developer tools ecosystem in ways that simply hinders adoption by more devs. A good and comprehensive LSP for example. It really needs to be on par with other languages to increase adoption
- iLemming 2y ago> I find most niche / less popular languages lack the developer tools ecosystem in ways that simply hinders adoption by more devs. Niche languages often serve specific purposes that don't require broad tooling. They also sometimes can leverage tooling from more popular languages. Less popular doesn't necessarily mean less capable - some niche languages have excellent tooling in their domain. Not to mention that not all developers need the same type of tooling or prioritize certain set of tools equally, like for example, for me personally - homoiconicity and REPL-connectivity in a language are far more important than LSP or some other things.
- jbjbjbjb 2y agoI’ve been dipping my toe in Lua and found some ways to achieve pattern matching of sorts and there’s a package called Tamale too but I’m not sure if that is used much.
- hyperbrainer 2y agoIf only there was an editor which could act as an interpreter for Lisp directly ...
- pdimitar 2y agoWake me up when its authors realize most of us don't want to "hack" our editors. They're still stuck in 1980. We actually have to pay bills and want to spend time with our families and go out in nature. I appreciate customization; that's why I moved to Neovim and not to a full-blown GUI IDE (and I'll never use those). But that editor you speak of practically requires me to fix the idiocies of plugin authors that can't be bothered to run 7 tests on their code. I get it, a lot of programmers are cult followers. I was as well. At one point though, pragmatism should prevail. The editor should ideally be non-laggy and not spit warnings after I move from one buffer to another. Just embarrassing.
- Zambyte 2y agoI haven't really touched my emacs config in years. I just set it up how I wanted and now I use it to pay my bills. It sounds like the flexibility was just too tempting for you to not hack on it when you should be doing other things.
- pdimitar 2y agoI have set it up 50 times and it crapped the bed every time. Before anyone yells "skill issue!", I'll say that if any plugin author can make the editor crap the bed, then the editor is not good. There are degrees to freedom. Complete freedom in such environments is a liability, not an asset. Say hi to the others in the ivory tower. And remind them not to do selective omissions in their supposed counter-arguments to "win" an argument, and that it's a cheap tactic.
- WhatIsDukkha 2y agoI have about 140 Emacs plugins running. I've never had to declare Emacs bankruptcy. 10 years of good times with Emacs+evil and 35 years of vim. Fwiw.
- ufo 2y agoLink to the macros: https://github.com/Grazfather/dotfiles/blob/master/nvim%2Ffnl%2Fmacros.fnl https://github.com/Grazfather/dotfiles/blob/master/nvim%2Ffn...
- threatofrain 2y agohttps://janet-lang.org https://janet-lang.org Also by the same author.
- sgt 2y agoDammit, Janet! Ok, looks good. I'll need to look into it.
- vanderZwan 2y agoWhomever downvoted you probably never saw the Rocky Horror Picture Show
- deleted 2y ago[deleted]
- 2mlWQbCK 2y agoI prefer Janet, but Fennel is great in places Lua is already supported, like in Löve2D. https://git.sr.ht/~benthor/absolutely-minimal-love2d-fennel https://git.sr.ht/~benthor/absolutely-minimal-love2d-fennel
- roxolotl 2y agoOne thing I've found that's really nice with Fennel + Love2D is you can even do hot reloading with nvim+conjure[0](I assume emacs too). I assume there's a way to hot refresh with just straight Lua but it feels very natural to do with a lisp. 0(example config): https://github.com/TheBlob42/love2d-fennel-neovim https://github.com/TheBlob42/love2d-fennel-neovim
- AlienRobot 2y ago>by the same author What? People are just creating new languages these days as if they were Javascript libraries? Let's say I wanted to make my own programming language. What's the easiest way to prototype it in a way I can share it with the world? Are the programming language development toolkits that come with a tokenizer library and things like that? Should I write my own program to output machine code? Or maybe it's easier to just transpile to Javascript?
- zitterbewegung 2y agoLinking to this without the fennel-lang.org main page which states the following "Fennel is a programming language that brings together the simplicity, speed, and reach of Lua with the flexibility of a lisp syntax and macro system." is a bad idea. Not having this sentence on your justification is ill advised. Not to detract from the language or anything I have found many programming languages justification to just not have an elevator pitch and I have a hard time understanding why this is the case. Unfortunately people's attention spans are extremely short.
- fredrikholm 2y ago> Not to detract from the language or anything I have found many programming languages justification to just not have an elevator pitch and I have a hard time understanding why this is the case. But they do have one, that you just copied?
- davidcalloway 2y agoI'm pretty sure the parent comment is pointing out that the quoted sentence from the main page ought to be present in the rationale page that is linked.
- cardanome 2y agoFennel is pretty nice. I wish it had gradual typing support though or at least allowed for type annotation for static tooling. Not that dynamic typing isn't a valid choice but with more and more languages getting gradual typing support it is hard to go back. I guess we could build something like Coalton but for Lua.
- codr7 2y agoI've been working on something along those lines in eli: https://github.com/codr7/eli?tab=readme-ov-file#type-checking https://github.com/codr7/eli?tab=readme-ov-file#type-checkin...
- HexDecOctBin 2y agoI did find this, though it seems runime only: https://github.com/dokutan/typed-fennel https://github.com/dokutan/typed-fennel Maybe a static system can be built upon it.
- benwilber0 2y agoI love seeing new languages targeting the Lua runtime. I've been adding Lua scripting support to pretty much everything I make now. I recently made my SSE server programmable with Lua and it's extended the functionality far beyond what I would have had the patience and time to do myself. Highly recommend Lua with mlua-rs Rust bindings. [0] https://tinysse.com https://tinysse.com [1] https://github.com/benwilber/tinysse https://github.com/benwilber/tinysse [2] https://github.com/mlua-rs/mlua https://github.com/mlua-rs/mlua
- ronsor 2y agoI don't have any use cases in mind right now, but this looks cool. You should try posting another Show HN.
- giraffe_lady 2y agoI would love to see a stripped back ML-style language that targets lua, just something like ocaml's type system and exhaustive pattern match right on top would be all I need. There have been a few attempts but nothing I know of that got usably far and is maintained. There might be a way to get standard ML to output lua or something but I'm not that familiar with it. I think it would be an incredible fit for a third backend for gleam, but they say they aren't adding any more beyond erlang and js.
- HexDecOctBin 2y agoYou might be able to repurpose CSharp.lua[1] to compile F# [1] https://github.com/yanghuan/CSharp.lua https://github.com/yanghuan/CSharp.lua
- Vedor 2y agoI think that LunarML [1] could fit this niche quite well. It's a StandardML compiler that targets Lua. I can't tell much more as I've only played with it a little and don't have much experience with ML languages in general, but it looks promising. [1] https://github.com/minoki/LunarML https://github.com/minoki/LunarML
- tmountain 2y agoGreat for casual and fun game development. TIC-80 has direct support, and it’s pretty easy to go from fennel to PICO-8.
- deleted 2y ago[deleted]
- R4tY9jQ2 2y ago[dead]
- giraffe_lady 2y agoAnother spot it's great for is in legacy lua programs that you inherit from who knows where, which in my experience is a lot of the live lua out there. It hooks into the module loader system so you can just freely mix functions and tables between the two.
- quectophoton 2y ago> Fennel's approach of compiling to Lua while maintaining meta-programming capabilities is elegant. Yeah, it is very nice to work with. The only tiny "complaint" I have is that it doesn't compile to pure Lua, but instead assumes you'll be running it together with Lua's libraries. I say this because, for me, the places where I'd like to use Fennel have a lot of overlap with the places where I'd like to use Lua without loading any of the provided libraries (e.g. embedding Lua into other software, instead of using it standalone).
- giraffe_lady 2y agoWait what do you mean? If I understand you correctly I use fennel for this all the time, I just copy the compiled lua into the place the program expects to find lua scripts.
- MyOutfitIsVague 2y agoSandboxed lua can't assume it has access things like debug libraries or any of the file IO, among other things. Many setups pretty aggressively remove and/or patch libraries and even large parts of the default global table. Assuming a vanilla lua library environment can make a project like this unusable in many places.
- giraffe_lady 2y agoOh, sure. I didn't realize fennel used those libs in the compiled lua output if you don't call to them. I've never run into this problem and again I've written a lot of fennel that is targeting locked down scripting environments. I probably don't use all of its features though so maybe just got lucky so far.
- duncanfwalker 2y agoThe comparison with Closure is really interesting. They make the point that they do less reinvention of Lua than Closure does with Java - functions, standard library, tooling. I'd love to know why. Is it just that Lua has less problems than old-Java
- macmac 2y agoClojure
- giraffe_lady 2y agoI'm not sure if this was the up front reasoning but a lot of lua code is run in situations where you don't have full control over the runtime or distribution method. So anything that requires C libs would automatically rule out fennel for a lot of projects that are essentially using someone's lua api as the target platform. Roblox, mud client scripting, openresty, that sort of thing. And these environments usually have so much added to them, pcre, stdlib extensions, class systems etc fennel works best not making any assumptions about any of that. It's just straight up the lua semantics, and so anywhere lua works it works. I've used it a lot and originally recoiled from this decision but now I think it is genius.
- frogulis 2y agoI get the impression that Fennel is intended as a different/better interface for Lua. In contrast, Clojure is intended as the language Rich Hickey wanted for writing the sort of applications he wrote, and the JVM happened to be a powerful (and already existing) platform that was suitable for doing that.
- nine_k 2y agoJVM has no notion of a function, only of a method! You don't have something to piggy-back on. Java stdlib from 15 years ago (to say nothing of 25) is a realm of heavy OOP and mutability everywhere, something you may not want to adapt your Lisp code to.
- TinkersW 2y agoI'd guess a major reason is that Java is statically typed, and Lua/Fennel are dynamic; making it easier to reuse any existing libraries.
- imbnwa 2y agoIf I'm writing an advanced Neovim config, I'd find YueScript[0] a lot more pertinent. Personally I can't deal with Lisp paren noise, I can hardly deal with semicolons. [0]https://yuescript.org/doc/ https://yuescript.org/doc/
- djaouen 2y agoI like the popularity of Fennel so that I can greedily keep Hylang and LFE all to myself!
- torginus 2y agoI do not understand the appeal of LISPy languages. I get that the parser is simple and elegant, but I believe the developer (of the compiler in this case) should serve the convenience of the user, not the other way around. Writing code like this is cumbersome and unnecessarily symbol heavy, and reading it isn't really nice as well. I'd rather have the language add that extra complexity into the parser than have me stare down these endless paretheses. Parsing something C-like is not that, hard, trust me, I've done it
- n4ture 2y agoI do not understand the appeal of non-LISPy languages. I get that most people are used to reading it and that they are efficent, but I believe the developer (of the compiler in this case) should serve the convenience of the user, not the other way around. Writing code like this is combersome and unnecessarily symbol heavy, and reading it isn't really nice as well. I'd rather have the language add those extra parens into the parser than have me stare down these endless semi-colon, linebreaks or indentation. Parsing something Lisp-like is not that, hard, trust me, I've done it.
- mgdev 2y ago<3
- NewsaHackO 2y agoThis doesn't really resonate with people though, as most people are more familiar with C-style notation. Also: >Writing code like this is combersome and unnecessarily symbol heavy Does not make sense in this context, as it mainly applies to Lisp-like languages that uses parentheses heavily.
- n4ture 2y agoYeah was going to change that part too for something like "Writing code like this is verbose and spans too many lines", but then I just thought it'd be better if it sounded more like the parent comment. And I understand it doesn't resonate with most, I just wanted to highlight how the initial parent comment was very subjective and not very substantive, some people didn't take the joke so well, I guess it could've sounded a bit passive aggressive. I personally enjoy both C-like and Lisp-like syntaxes and languages, I do have a sweet spot for Forth tho. But back on topic, Fennel is a great language, working with Love and Fennel is really nice. And if the parentheses can seem off-putting for some, I'd highly encourage to give it a shot as you can quickly get past it and see how comfy it feels to have your statements properly demarkated. S-expr shine the most when working with XML-like structure. Spinneret[1] was the most fun I ever had working with HTML, every other templating engine feels subpar now that I have tasted that sweet nectar.. [1] https://github.com/ruricolist/spinneret https://github.com/ruricolist/spinneret
- kras143 2y agoI believe that people who complain about parens have not coded in Lisp (atleast not enough)! Once you get over the "parens", the homogeneity of the language shines through and you will appreciate why some people like me never get over Lisp.
- lerax 2y agoit's kinda funny that whole noise about parenthesis. For a experienced Lisper parenthesis are so meaningless that can be ignored by reading good indented code, however... for a newbie, the amount of parenthesis can be a real nightmare. All that can just be properly solved by using a decent editor that support good parenthesis edition... like emacs. Truly funny. I've been on this community for more than 10 years and always the same thing.
- jlundberg 2y agoSemi-related for those looking for other languages built on top of Lua: https://moonscript.org/ https://moonscript.org/
- ersiees 2y agoI don’t love fennel, it usually dominates the whole taste of a dish for me
- stronglikedan 2y agoBut in the spirit of answering the headline's question, it's because nothing else tastes quite like it!
- akoboldfrying 2y agoI'm a bit puzzled by whether Fennel is trying to make "different things look different" as they claim, or not. On the one hand, Fennel separates Lua's multipurpose "for" into "for" (for numeric ranges) and "each" (for iterators). On the other hand... Don't macros and function calls, two rather different things with different powers, look identical in Fennel? On the "Values" page, they also mention a macro that alters the lexical scope somehow. This macro is now deprecated, but its mere existence implies that such a macro can be expressed in Fennel -- that is, that it's possible to write Fennel code that causes what looks like an ordinary function call to do surprising things to the program state. As they rightly mention (on either this page or the "Values of Fennel" page), the advantage of constraining a language is that you can more easily tell what a program is doing (and not doing) at a glance. But this seems to be undone by giving a pass to (unhygienic?) macros.
- z5h 2y agoOk I’m genuinely convinced I’d be happier using Fennel than using Lua in instances where I need to use Lua. I’m not currently using Lua for anything. Maybe if I write a Pico-8 app…
- NoPicklez 2y agoWhy not Fennel?
- geekraver 2y agoApart from Forth, Lisp and Lua, Tcl also deserves mention as a small embeddable language. Not sure of its state today; I think by v8 it had started to get more complex, but its original incarnation was very simple. I remember getting Ousterhout’s book and being so enamored with the elegant design that I felt compelled to just implement it myself from scratch, which took just two days.
- RKFADU_UOFCCLEL 2y agoIs it a theorem that languages named after trendy (such as spices) or shiny things die fast? Ruby, Crystal, Carbon, now Fennel.