Live data from Hacker News

Bog – small, strongly typed, embeddable language

github.com

51–55 of 55 posts

Re: Bog – small, strongly typed, embeddable language

#51
post #31
post #8

Pretty interesting. I'm a professional user of Lua, and while I love it, I really get frustrated at a lot of aspects of it, especially how loose the typing is. I've long wished there were more strongly typed alternatives, but just nothing compares to the performance, stability, and quality of documentation of Lua. I'm not sure how I would embed this in a non-Zig project, though.

Curious, if you don't mind, what kind of professional usage with Lua you work on? I was working on some Nginx/Openresty scripting with Lua module to implement kind of web edge service and really liked it.

We use a heavily stripped and sandboxed Lua interpreter for user scripts in a monitoring system. The initial approach was going to be WebAssembly, but that didn't pan out for a couple reasons.

Much of the functionally has been wrapped or customized to disallow any system access that doesn't go through an access control layer, including for require, and disallowing catching certain errors with pcall and through coroutines. Anything that could feasibly break the sandbox is also removed, like the debug package, and the ability to load bytecode (text sources only). The actual Lua sources are 100% vanilla, though we complete it with C++ to be compatible with the rest of the codebase.

Re: Bog – small, strongly typed, embeddable language

#52
post #12

Earlier quoted context omitted.

I haven't, but I might have to do a lot of work to get it working, as my typical use of Lua is deeply embedded and customized, and doesn't allow any filesystem access. I will definitely look into that, though, thank you. The only real Lua dialect I'm familiar with in that area is Moonscript.

There's many different approaches to typed Lua: - https://luau-lang.org (interpreted / sandboxed) - https://terralang.org (JIT interpreted) - https://nelua.io (Lua -> C) - https://typescripttolua.github.io/ (TS -> Lua) - https://github.com/teal-language/tl (Teal -> Lua) - https://github.com/sumneko/lua-language-server (IDE only typing) With minimum effort you can get a lot of benefit from using Sumneko's Lua language…

Terra and Nelua are both very different in goals than Teal. Teal is literally gradual types integrated into Lua keeping as many of Lua's idioms as possible (to a fault[1]). Terra and Nelua are both very metaprogrammable systems programming languages. Nelua's goals are primarily to soften C's rough edges, comparable to something like Nim.

There's another one you missed in Pallene[2]. But again, it's goal was to optimize the stack sharing involved in using the C API. It also adds types though and maintains Lua idioms as much as possible.

[1]: https://github.com/teal-language/tl/discussions/339

[2]: https://github.com/pallene-lang/pallene

Re: Bog – small, strongly typed, embeddable language

#53
post #33
post #21

Is it my imagination or is the most embedded language in the world C# these days? Which doesn’t really look anything like a classic language designed for embedding.

Embed the whole .NET runtime? Huh?

People literally do that all the time! Godot does it, Unity does it...

Re: Bog – small, strongly typed, embeddable language

#55
post #43
post #42

Earlier quoted context omitted.

Do you think real people will get confused and think the only way to write hello world in bog is using a variable ? Or do you think most people will automatically adjust and think "hello world in itself doesn't show much, so the author decided to include something more informative and keep call that hello world" ?

I think he shouldn‘t have called it a Hello World if its purpose is to showcase a language feature instead of serving as an actual Hello World.

Obviously the examples in a README for a programming language are going to showcase said language's features.
Post reply on HN