Better HN
topnewbestaskshowjobs
Log inSign up

Hoppetosse

130 karma · joined May 6, 2019 (7y ago) · 13 submissions

Submissions

comment 4y ago · link · parent

Bob Nystrom describes his language Wren through number of semicolons, which I find interesting.

Doesn't work for every language, though =P

comment 4y ago · link · parent

If you want to handle the error and also bubble it up, maybe even changing the what error bubbles up, you can just return an error from within the catch block after doing whatever handling you want. Either the captured error or something else.

Specifically for recursive descent parsers, I pass around a reference to an regular struct that acts as an ErrorInfo object, and use that to pass diagnostic information up the stack. Control flow is still managed by the error returns, any additional info goes in the parameter.

There is (was?) a proposal to add that capability to the language but Im not sure it had much traction.

comment 5y ago · link · parent

It can also be an artifact of a foreign language. The french interrogatory form can be the same as the declarative. It seems likely in this case, their use of "therefore" is equivalent to the fench "alors" which is often employed to "interrogate a declaration"

comment 5y ago · link · parent

There are a few similar open source projects, like Tic-80 and Liko-12. Both can be programmed with Lua, but Tic-80 can also be programmed with others like Javascript and Wren and the porting process can be fairly simple.

comment 5y ago · link · parent

The @Vector provided is actually a reference to SIMD vectors and there has been discussion to rename it to something that reflects this more clearly.

https://github.com/ziglang/zig/issues/7305

comment 5y ago · link · parent

In many ways, it already has. Zig has been under development for several years now and its syntax and semantics have change a lot since its first iterations. There are still some breaking changes coming that you can find at https://github.com/ziglang/zig/issues.

One of the cooler aspects of Zig's breaking changes is that its formatting tool can automatically update your code to the new syntax.

comment 5y ago · link · parent

The standard library has a General Purpose Allocator that can catch some of the errors that ASAN can, like memory leaks.

comment 6y ago · link · parent

Zig was started with that exact use case at the forefront of its design.

- Zig has no hard dependency on libc, it's the user's choice whether he wants to link it or not. It ships musl libc and can build/link it for most (all?) supported targets.

- Most of Zig's standard library works on freestanding targets. No runtime needed. There are no implicit allocators, so the user must use an allocator shipped with the standard library or implement their own.

- Standard library is still in its early days but already provides a lot of functionality out of the box, from containers to io.

- Using the standard library is optional. When it is used, only what is used gets included. The standard library is built from source every time (though there is caching) and its semantic analysis basically does LTO in the codegen stage so you end up with pretty slim binaries.

Here's a couple of examples:

- https://github.com/andrewrk/clashos

- https://github.com/AndreaOrru/zen

comment 7y ago · link · parent

I forked a project, didn't even realize it didn't have a license. I'll ask the original creator to decide.

comment 7y ago · link · parent

More than one person has mentioned this. Maybe an audio cue will make it more obvious it's on purpose...

comment 7y ago · link · parent

Thanks for the feedback. I've reworked the page so that it's less likely that the game does not fit in a screen without scrolling - not ideal, but it'll help!

comment 7y ago · link · parent

This is actually a port of the demo made by Andrew Kelley, which was originally written for the desktop using GLFW.

My plan is to integrate my changes into the original project so that it can export to desktop and web.

13.

Tetris clone written in Zig running on WebGL and WebAssembly(raulgrell.github.io ↗)

215 points · by Hoppetosse · 7y ago · 69 comments