Live data from Hacker News

Bog – small, strongly typed, embeddable language

github.com

41–50 of 55 posts

Re: Bog – small, strongly typed, embeddable language

#41

Thank you for posting this. > let {print} = import "std.io" An idea obvious in hindsight that I hadn't thought before - if import returns an environment and let can destructure, then a pattern match can bind an explicit subset of that import. Something like: `(let {print read} (import io) (print (read)))` Further down I find essentially that example (with input instead of read) and destructuring assignment within fun…

This Syntax has the flaw that autocomplete cannot assist you before the from import clause has been added...

Re: Bog – small, strongly typed, embeddable language

#42
post #36

Earlier quoted context omitted.

I read that as "Yes, Bog does formatted strings", and appreciate the density.

The purpose of a Hello World, however, is not to showcase language features, it’s to provide a minimal program that produces output, to test that your dev environment is working properly, and for you to learn how to operate it. Adding any unnecessary complications to it only adds further sources of error.

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" ?

Re: Bog – small, strongly typed, embeddable language

#43
post #42
post #36

Earlier quoted context omitted.

The purpose of a Hello World, however, is not to showcase language features, it’s to provide a minimal program that produces output, to test that your dev environment is working properly, and for you to learn how to operate it. Adding any unnecessary complications to it only adds further sources of error.

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.

Re: Bog – small, strongly typed, embeddable language

#44
post #27
post #6

Earlier quoted context omitted.

Something I hate about about c is that you don't know where the hell somefunc() came from. Some languages have foo.somefunc() which I think works quite well although iffooisrealllylong.function() is a risk. I suppose this gets you the best of both worlds. Although using let does seem a bit weird to me. It seems conceptually misleading.

> Something I hate about about c is that you don't know where the hell somefunc() came from. I think you mean something you hate about not using an IDE with the language. One can do `from onoz import *` in python and Java to have a similar "wait, where did do_magic() come from?" experience, and then Scala will see your wildcard import and raise you implicit methods , which can die in a raging fire tornado

>I think you mean something you hate about not using an IDE with the language

Well it's a 'feature' of the language so the criticism still stands. Ides could solve a lot of language warts but we still rightfully criticise the language for the warts. C's lack of memory safety could be solved by good programming practices, but we still criticise c for the lack of memory safety.

Re: Bog – small, strongly typed, embeddable language

#45
So this is from my particular bias, but any language that touts itself as embedded, I really want to understand it's memory allocation model and approach! I see it's built on Zig, but does it support custom allocators within Bog itself? I'd love to use embeddable languages like this in embedded firmware, but a lot of them have issues with heap fragmentation when actually used in-anger, I've found.

Aside from my biased nitpick, it looks pretty neat!

Re: Bog – small, strongly typed, embeddable language

#47
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.

Have you heard of Teal ( https://github.com/teal-language/tl )? It's like typescript for Lua made by Hisham. It also has the concept of declaration files so you can import (and type) existing Lua modules if needed.

Teal only type checks when run from the command line though, which isn't the best when you want to embed Lua. At least thats what my reading of the docs says, I'd be happy if I'm wrong. But reading the docs now, it doesn't seem to say that any more - maybe its changed recently?

Edit: Oh yes it's still like that 'When loading and running the Teal module from Lua, there is no type checking! Type checking will only happen when you run tl check or load a program with tl run.' from https://github.com/teal-language/tl/blob/master/docs/tutoria...

Re: Bog – small, strongly typed, embeddable language

#48
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.

> more strongly typed alternatives

See also this list for comparison https://github.com/fubark/cyber/issues/6, if you dont want lua by a meta-compiler.

If you want non-allocating scripting for optimal performance (and io limited to what you provide as buffer), go for https://dascript.org/. I dont think there are currently other projects with that performance (+ also inspired by Zig). Though, not sure how clunky it is to use.

Re: Bog – small, strongly typed, embeddable language

#49

Love how this language is explained with code only.

That's actually something that struck me negatively (about the README, not about the language).

Sample code is great, but I'd be happier with a README that says something about the language (and, to a lesser extent, about its implementation).

Apparently Bog is based on Zig, but I didn't learn that until after reading about 80% of the README -- and since I'm not particularly familiar with Zig, I don't quite know what to do with that information.

Probably the author had a narrower audience in mind when writing the README.

Post reply on HN