HNHacker News
TopNewBestAskShowJobs

0xjnml

32 karma · joined November 6, 2019

submissionscomments
0xjnml··on Just Use Go
> Yeah, it breaks when the author decides to move from Github into Gitlab to protest against Microsoft.

The import path is disconnected from where the build system looks for the files. Of course, the default is to use the import path as an URL, right, but nothing forces you to do that. And if you do, *you* lock yourself to the hosting you use. But that can be hardly blamed on Go.

Documentation here: https://pkg.go.dev/cmd/go#hdr-Remote_import_paths

Full example: https://github.com/rsc/swtch/blob/master/app/rsc-io/main.go

tl;dr: Serve this at your domain, update the repo-root when changing host platform for your code: <meta name="go-import" content="import-prefix vcs repo-root">. No one else has to do anything.

0xjnml··on Show HN: Gova – The declarative GUI framework for Go
Shameless plug: https://pkg.go.dev/modernc.org/tk9.0
0xjnml··on [dead]
The results for the 26.03 benchmark run are in. (golang)

With the recent release of ncruces' drive switching from wazero to wasm2go, there have been expectations of possibly substantial improvements. Our numbers confirm this: the wasm2go-based driver (ncruces) has recovered significant ground compared to the February results, narrowing the gap with its competitors. The driver erased its worse performance on targets not natively supported by wazero. Well done, u/ncruces!

0xjnml··on [dead]
CGo-free as always. See CHANGELOG.md for details.

https://gitlab.com/cznic/sqlite/-/blob/master/CHANGELOG.md

0xjnml··on Defer available in gcc and clang
> I wonder what the thought process of the Go designers was when coming up with that approach.

Sometimes we need block scoped cleanup, other times we need the function one.

You can turn the function scoped defer into a block scoped defer in a function literal.

AFAICT, you cannot turn a block scoped defer into the function one.

So I think the choice was obvious - go with the more general(izable) variant. Picking the alternative, which can do only half of the job, would be IMO a mistake.

0xjnml··on [dead]
I wrote a post exploring egg, a new tool that generates recursive descent parsers from Go-style EBNF. The most interesting feature is that it doesn't generate struct nodes; it encodes the AST into a flat []int32 slice for cache locality and reduced GC pressure. I included a walkthrough of generating a JSON parser with it.
0xjnml··on The coming industrialisation of exploit generation with LLMs
See https://pkg.go.dev/modernc.org/quickjs
0xjnml··on Golang's big miss on memory arenas
> If you really want an arena like behavior you could allocate a byte slice and use unsafe to cast it to literally any type.

Only if the type is not a pointer per se or does not contain any inner pointers.

Otherwise the garbage collector will bite you hard.

0xjnml··on The Green Tea Garbage Collector
YouTube is one such.
0xjnml··on Qbecc – QBE based C compiler
Documentation for the QBE IL is here: https://c9x.me/compile/doc/il.html

I find it quite usable.

0xjnml··on Qbecc – QBE based C compiler
Maintainer here, AMA.
0xjnml··on New email protocol for user-triggered email forwarding (anti-SCAM)
You took the wrong exit, sir. This is the right way: https://en.wikipedia.org/wiki/Request_for_Comments
0xjnml··on Comparing Golang SQLite to C SQLite
> The page you linked compares golang bindings against each other, not C against golang like my test did

No one disputed that. But it follows that your benchmarks are comparing C to [some very] outdated versions of Go packages. Which is what I tried to point out.

0xjnml··on Comparing Golang SQLite to C SQLite
It seems you're using some old Go package versions for your benchmarks.

See https://pkg.go.dev/modernc.org/sqlite-bench#readme-tl-dr-sco... for the numbers using the more recent versions.

0xjnml··on Show HN: Pure Go QuickJS JavaScript engine (Golang)
It is transpiled from C to Go, meaning 90+% of the effort is mechanized.

Ad performance. In some micro benchmarks the Go version is ~4x slower: https://gitlab.com/cznic/libquickjs/-/blob/675ee343753c42341...

However, it's already ~25% faster, in a different benchmark, than another Go JS VM written from scratch: https://pkg.go.dev/modernc.org/quickjs@v0.14.0#hdr-Performan...

I am currently looking around if it can be improved more and there are some ideas to try out.

0xjnml··on Layered Design in Go
go.mod files have no dependencies, so neither they can have circular dependencies.

go.mod files just list the dependencies of their respective package.

0xjnml··on Tcl/Tk application binaries through Go
- Turn Tcl code into standalone executables

- Easily cross-compile these executables for other systems

0xjnml··on Are Golang slices dynamic arrays or fat pointers? (2024)
Go slice is neither of that, it is a window into an array.
0xjnml··on Being a developer in the age of reasoning AI
Time spent writing code is IMO the smallest part of software engineering.

Optimizations give better results when care is taken first about the most costly parts.

0xjnml··on VisualMD: A CGo-free WYSIWYG Markdown editor in Golang
Check it out!

$ CGO_ENABLED=0 go install modernc.org/visualmd@latest

0xjnml··on Equ: A Plain TeX Math Editor in Golang and Tk9.0
Check it out!
0xjnml··on In a leaked recording, AWS CEO tells most developers could stop coding soon
Except AI was correct this time.

"It is rare to Close a DB, as the DB handle is meant to be long-lived and shared between many goroutines."

source: https://pkg.go.dev/database/sql#DB.Close

0xjnml··on Building static binaries with Go on Linux
> This would be much harder to do with modernc.

https://go.dev/play/p/IztwH9Jl68i

0xjnml··on Show HN: WAL Implementation in Golang
Another simple WAL: https://pkg.go.dev/modernc.org/file#WAL
0xjnml··on Go Enums Still Suck
Go does not have enum types and Go does not have [Pascal-style] subrange types.

The correct title should read "Go named constants suck", but then I'm not sure what's wrong about them.

0xjnml··on Go Enums Suck
Go enums cannot suck because Go has no enum types, full stop.
0xjnml··on What's your go to literature to build Go libraries?
> https://github.com/golang-standards/project-layout

The name of the repo is really and intentionally misleading. rsc filled an issue there to point this out, but the repo maintainer just disabled issues altogether so now no one can see it.

Even when it would not have such parasitic name, many seasoned Go programmers, me included, consider the self-proclaimed "Standard Go project Layout" as the opposite of what is good and advisable.

Unfortunately, the name just works, so it is being recommended all over the Internet since its inception.

0xjnml··on Golang Standard Package Layout
See https://go.dev/doc/modules/layout (Note: Even there the word 'standard' does not apear at all.)
0xjnml··on Golang: Toy Go compiler in < 200 SLOC
Go0 is a [self] educational toy Go compiler for a minimalistic subset of Go. It demonstrates how to use the modernc.org/libqbe compiler back end.
0xjnml··on Libqbe for Go
Package libqbe is a compiler backend. It compiles SSA source code to assembler source code.
Page 1 of 2Next →