mastodontech.de ist einer von vielen unabhängigen Mastodon-Servern, mit dem du dich im Fediverse beteiligen kannst.
Offen für alle (über 16) und bereitgestellt von Markus'Blog

Serverstatistik:

1,5 Tsd.
aktive Profile

#lua

8 Beiträge7 Beteiligte2 Beiträge heute

Being rather frustrated with programming Clojure in IntelliJ, (mainly because Cursive and IdeaVim don't like each other) I tried to set up Neovim with the Conjure plugin and it 's an absolute blast to use the REPL with it.

Also I discovered that there is a Lisp on top of Lua called Fennel, which I'm looking forward to play with

#Programming#Clojure#Lua

「 Pallene is a statically typed and ahead-of-time compiled sister language to Lua, with a focus on performance. It is intended for writing performance sensitive code that interacts with Lua, a space that is currently filled by C modules and by LuaJIT. Compared to C, Pallene should offer better support for interacting with Lua data types, bypassing the unfriendly syntax and performance overhead of the Lua-C API 」

github.com/pallene-lang/pallen

Pallene Compiler. Contribute to pallene-lang/pallene development by creating an account on GitHub.
GitHubGitHub - pallene-lang/pallene: Pallene CompilerPallene Compiler. Contribute to pallene-lang/pallene development by creating an account on GitHub.
Antwortete im Thread

In other #iocaine news, I'm doing some final polishing on #Lua scripting support, to make it as convenient as #Roto.

Right now, there's a differenc between how Lua and Roto scripts are loaded: with Roto, one needs to give a path to a directory, and pkg.roto will be loaded from there, and any imports will be relative to that directory.

With Lua, one gives iocaine a file path, and - currently - needs to set up the package.path search path manually.

So here's what I'll do: I'll make iocaine require a directory for Lua too, and it will add it to package.path, and will require("main"). The required module will also have to return a table with at least a decide key, and an optional run_tests key. This will simplify finding the functions to run, and will greatly reduce the number of special cases.

While it has its own issues, there are several good reasons why my favourite #ProgrammingLanguage in the real world is #C

Why not #Go?
Because it's from #Google.

Why not #Csharp or #Fsharp?
#Microsoft.

Why not #Rust or #Zig?
#LLVM (aka #Apple & friends).

Ultimately, most of languages I avoid like the plague are controlled by #BigTech one way or another.

C is simple enough to get several alternative compilers based on useful standards.² ³


¹ In theory I still prefer #Oberon07, but when I want to code something useful I still use C instead to lower the entry barrier for other devs, because there are too many incompatible implementations of the compiler and "standard" library.

² Ok, #Python, #Scheme and #Lua have similar qualities, but for the tools I write I usually prefer binary executables with no runtime.

³ No, #C++ is not an option. 😉
harmful.cat-v.orgBjarne Stroustrup: "I Did It For You All..."

🖥️ My ultra-budget server powering websysctl.alfonsosiciliano.net has been running smoothly for the past 2 months. So far, so good!

📈 #Crawlers hit tens of thousands of sysctl parameter pages daily. That's fine, since robots.txt allows it. But why keep requesting non-existent pages as if the site were built with WordPress 😤 ? Fortunately, the stack (#FreeBSD :freebsd: + #OpenResty 🌐 + #Lapis ✏️ + a custom-built #database 📦 ) stays well within the limited resources of my $5/month cloud server.

The code might soon be #OpenSource stay tuned!

#UNIX#sysctl#WebDev

The @ardour #Lua scripting workshop at #LAC25 #INSA #Lyon has just started. And I am curious to learn how to extend the functionalities of this great free and #OpenSource #DAW in a programmatically way in #realtime.

As @lualang is #CrossPlatform like #Ardour is, you can draft your script on a Windows machine at work and refine it on your #Linux computer later at home, for example.

Let's see how we can automate tasks in Ardour sessions, which otherwise would require another person operating #plugin parameters, session properties, #routing, etc. interactively.

Fortgeführter Thread

Unfortunately, there are gotchas there, too.

(fn decide [request]
  Outcome.not_for_us)

This #fennel code compiles to the following #lua:

local function decide(request)
  return Outcome.not_for_us
end
return decide

The problem here is that I'm not require-ing this file. I maybe should. Without require, that return makes little sense, and the decide function won't be found in the global scope, so...

Error: error converting Lua nil to function

Which makes perfect sense. Except the error message is bad, and needs to be improved.

Today's adventures begin with trying to make #iocaine play well with #Fennel. There's work to be done on this front...

For starters, I don't think I will be able to support running the Fennel compiler as part of the init process. It seems to require debug and assert, which I'm not sure I want to make available to the Lua runtime in iocaine.

debug requires mlua.unsafe_new(), which in turn requires an unsafe block, and I'm not comfortable with that. Not even sure how I can make assert available, mlua doesn't seem to provide that as part of stdlib.

So, next best thing: compiling #Fennel to #Lua ahead of time!

Antwortete im Thread

Ok, dispatch is in, some quick benchmarks, using a script that does nothing but return Outcome::NotForUs:

  • lua (luajit): 127k req/sec
  • lua (luau-jit): 142k req/sec
  • roto: 173k req/sec

So #Roto wins over #Lua by a sizeable margin here, even with luau-jit (which, iirc, is supposed to be the fastest).

However, #Lua is fast enough. I'm willing to trade some performance for user convenience, and Lua is at a spot where the performance drop, while noticable, is within acceptable limits, and is offset by the convenience of the language.

Antwortete im Thread

In a number of ways, #Lua is going to be a better fit than #Roto: it's a far better known language, and a whole bunch of things are easier to do in Lua.

Do I regret going with #Roto first? Absolutely not. I like Roto's syntax better, and prefer its minimalism over Lua. From what I remember about my prior benchmarks, Roto is also significantly faster. But I'll do some side-by-side comparisons once the Lua support is in a better place, and once I can actually choose which one to use.

Right now I just made a struct that implements the same functions as MeansOfProduction, and replaced Roto with Lua. That is obviously not how it will work down the road.