wazero
yaegi
Our great sponsors
wazero | yaegi | |
---|---|---|
52 | 38 | |
4,465 | 6,533 | |
3.3% | 2.4% | |
9.8 | 5.6 | |
13 days ago | 23 days ago | |
Go | Go | |
Apache License 2.0 | Apache License 2.0 |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
wazero
-
Wazero: The zero dependency WebAssembly runtime
https://github.com/tetratelabs/wazero/releases/tag/v1.7.0
This includes the final release of the new optimizing compiler, which is a big improvement over the previous one.
The new version also adds experimental support for threads and snapshot/restore (setjmp/longjmp).
This is already being used by go-pgquery, all will mean that sqlc won't need to ship to almost copies of wazero (these features had been implemented on a friendly fork, and have now been up-streamed).
- Show HN: My Go SQLite driver did poorly on a benchmark, so I fixed it
-
Making Games in Go for Absolute Beginners
> Go actually has one of the best WASM runtimes https://github.com/tetratelabs/wazero
> I am the developer of Astral Divide, which is entirely written in Go: https://store.steampowered.com/app/2597060/Astral_Divide/
Your game looks great, congrats on your progress! I especially enjoyed how the zoom works when you're leaving/arrive planets, and the unique propulsion system (also, the anchor made me giggle!).
> lack of data structure packages
I tend to not need many, so I'd be curious if you can recall any structure in particular which you couldn't find? No biggie if not.
> package structure not suited for games
I'm not a game dev, but I've seen some larger games such as https://github.com/divVerent/aaaaxy/tree/main/internal (if you haven't played it before—do it!) which seem to be able to place everything into separate packages without issue, so perhaps there's something to gleam from their design?
> maps are random when iterated
Hash map iteration shouldn't be sorted in _any_ language (here's Rust, for example https://play.rust-lang.org/?version=stable&mode=debug&editio... (Python makes it _appear_ as if dicts are sorted hash maps, but that's only because it doesn't only use a hash table, but a vector as well (same as you'd have to do in Go))), otherwise it would cause both portability and security (https://github.com/golang/go/issues/2630) issues. You can use a b-tree (which was probably the data structure you wanted there) if you aren't willing to sort it yourself.
> modding options
If you don't care about unloading https://github.com/pkujhd/goloader
Go actually has one of the best WASM runtimes https://github.com/tetratelabs/wazero
It also has a bunch of libraries for embedding scripting languages https://awesome-go.com/embeddable-scripting-languages, with Tengo _probably_ being quickest https://github.com/d5/tengo
I'd _highly_ recommend Ebitengine in the future, as not only have there been multiple brilliant games using it, but it also has Switch/Android/iOS support, and you can find help with any issue whatsoever in their Discord. People have built 3D games with it, and Hajime is an absolute beast of a developer.
-
WASM by Example
That depends entirely on the runtime, and its WASI implementation.
wazero [1], which I'm most familiar with, allows you to decide in a relatively fine-grained way what capabilities your WASI module will have: command line arguments, environment variables, stdin/out/err, monotonic/wall clock, sleeping, even yielding CPU… Maybe more importantly, filesystem access can be fully emulated, or sandboxed to a specific folder, or have some directories mounted read-only, etc; it's very much up to you.
I've used it to wrap command line utilities, and package them as Go libraries.
For one example, dcraw [2]. WASM makes this memory safe, and I can sandbox it to access only the single file I want it to process (which can be a memory buffer, or something in blob storage, if I want it to).
Wazero looks super cool. I saw somewhere that programs can be run with a timeout, which sounds great for sandboxing. The program input is just a slice of bytes [1], so an interesting use case would be to use something like Nats [2] to distribute programs to different servers. Super simple distributed computing!
--
1: https://github.com/tetratelabs/wazero/blob/main/examples/bas...
-
Show HN: Sqinn-Go is a Golang library for accessing SQLite databases in pure Go
It is slower.
The WASM runtime wazero [1] uses a compiler on amd64 and arm64 (on Linux, macOS, Windows, and FreeBSD), but the current compiler is very fast (at compiling), but very naive (generates less than optimal code).
An optimizing compiler is currently being developed, and should be released in the coming months. I'm optimistic that this compiler will cover the performance gap between WASM and modernc.
[1]: https://wazero.io
-
Jacobin: Minimal JVM written in Go and capable of running Java 17 classes
I am a fan of the Jacobin project! For your uses, you may also want to consider wazero [1], a pure-go WebAssembly runtime. Full disclosure: I am on the team :)
[1]: https://wazero.io/
-
Val, a high-level systems programming language
No longer does Wasm/WASI need JS host! There are many spec-compliant runtimes built for environments from tiny embedded systems up to beefy arm/x86 racks:
- https://github.com/bytecodealliance/wasm-micro-runtime
- https://github.com/bytecodealliance/wasmtime
- https://github.com/wasmerio/wasmer
- https://github.com/tetratelabs/wazero
- https://github.com/extism/extism (disclaimer, my company's project - makes wasm easily embeddable into 16+ programming languages!)
yaegi
-
Go: What We Got Right, What We Got Wrong
Yes. There are long standing feature requests for (e.g.) the reflect package that simply don't get done because they'd break this assumption and/or force further indirection in hot paths to support "no code generation at runtime, ever".
Packages like Yaegi (that offers an interpreted Go REPL) have "know limitations, won't be addressed" also because of these assumptions.
https://github.com/golang/go/issues/4146
https://github.com/golang/go/issues/16522
https://github.com/traefik/yaegi?tab=readme-ov-file#limitati...
- Fourteen Years of Go
-
Gojekyll – 20x faster Go port of jekyll
There is always https://github.com/traefik/yaegi - a Go interpreter written to make it easy to write plugins.
- Jacobin: Minimal JVM written in Go and capable of running Java 17 classes
-
Can Go run statements in cmd like Python?
I think https://github.com/traefik/yaegi comes as close as using the python interpreter in you CLI, but for Go
-
Can Go files be compiled by themselves?
There's a go interpreter: https://github.com/traefik/yaegi It could run programs without compiling them, but there're some limitations.
-
referencing packages on the internet and using go plugin
I'd recommend looking into a different approach for plugins such as hashicorp/go-plugin (which uses multiple process PIDs and RPC communication between them) or traefik/yaegi (which implements a Go-compatible scripting language that can be interpreted at runtime and which still supports most Go modules).
-
Mun v0.4.0: a statically-typed scripting language like Rust, written in Rust
Why do we need a language like Rust when we have Rust. Why not just create a Rust interpreter. (There's such an interpreter for Go, BTW, https://github.com/traefik/yaegi )
-
Plugo - A plugin library for Go.
A cool solution I saw was Traefik's yaegi module. They basically created an interpreted scripting language with Go compatible syntax (turning Go into an interpreted, not compiled, language). I haven't tried this but it sounds like it brings the better parts of dynamic languages like Python's plugin support to Go - plugin writers can still write "Go" code, which can load dynamically.
-
Best local Golang REPL for learning?
I've used https://github.com/traefik/yaegi REPL combined with rlwrap for nicer readline experience. But sadly no completion.
What are some alternatives?
wasmer - 🚀 The leading Wasm Runtime supporting WASIX, WASI and Emscripten
wasmtime - A fast and secure runtime for WebAssembly
golive - ⚡ Live views for GoLang with reactive HTML over WebSockets 🔌
gomacro - Interactive Go interpreter and debugger with REPL, Eval, generics and Lisp-like macros
wasmer-go - 🐹🕸️ WebAssembly runtime for Go
grule-rule-engine - Rule engine implementation in Golang
gobook - Simple in Pure Go in Browser Interactive Interpreter
scriggo - The world’s most powerful template engine and Go embeddable interpreter
gophernotes - The Go kernel for Jupyter notebooks and nteract.
gop - The Go+ programming language is designed for engineering, STEM education, and data science
go - The Go programming language
klipse - Klipse is a JavaScript plugin for embedding interactive code snippets in tech blogs.