Live data from Hacker News

Viewing profile — tiehuis

tiehuis

HN member
Joined
Thu, Nov 17, 2016, 8:28 AM UTC
HN karma
105
Public activity
24 items

About tiehuis

in New Zealand

marc@tiehu.is

https://tiehu.is

https://github.com/tiehuis

Recent public activity

  1. comment
    Comment #43529506

    Using a portable minimal markdown dependency (such as cmark [1]) I think markdown can be quite a low barrier here. I personally do similar to what you have described on my blog, wi…

  2. comment
    Comment #40131340

    There is an issue proposing this approach: https://github.com/ziglang/zig/issues/4284

  3. comment
    Comment #38851802

    Zig had a similar issue which I made an MR to fix. I didn't actually notice Rust had the same issue but that's probably just my forgotten knowledge with how the vec! macros expand …

  4. comment
    Comment #37455497

    I as well moved to this sort of approach a few years ago [1]. Definitely like the simple approach and it just stays out of the way. [1] https://tiehu.is/blog/blog1

  5. comment
    Comment #36529939

    I wouldn't assume that just because Andrew has written the proposal it will be accepted. There have been plenty of times where proposals from Andrew have been rejected and/or rewor…

  6. comment
    Comment #33948507

    Good comment. Andrew did remove zstd compression on the wasm artifact in this commit [0] for the reasons you mention [1]. [0] https://github.com/ziglang/zig/commit/c51288f1f6be20be…

  7. comment
    Comment #30218676

    There is a recent draft PR [1] to merge this into the zig compiler itself. LLVM is being placed as a an optional component in the future [2]. Using arocc to fill this gap would mea…

  8. comment
    Comment #28499180

    This is a nice write-up. Since zig has quite extensive compile-time functionality, one drawback is it is often easy to miss untested branches, especially for non-native targets if …

  9. comment
    Comment #19611829

    As an example, xxHash [1] would probably get you an easy 5-10x performance improvement over Blake2b. So there are some easy improvements if the cryptographic requirement is not nee…

  10. comment
    Comment #19611311

    Here is a repository with a few more small code examples which may be helpful: https://github.com/tiehuis/zig-rosetta The code itself should be up to date for most, but I'm aware o…

  11. comment
    Comment #19270561

    A comparable implementation in Zig. Key detail is `@fieldParentPtr` [1], which has the same functionality as `container_of`. const std = @import("std"); const wl_list = struct { pr…

  12. comment
    Comment #17260704

    Zig's errors are actually different and the variants can be statically known. Error type returns are not usually specified since they can usually be inferred. They can be explicitl…

  13. comment
    Comment #17187008

    > But if I understand correctly, out-of-the-box, Zig's `union` doesn't get a tag type, right? That's what I meant by Rust's `enum` being safer: you can use it safely in Zig, but yo…

  14. comment
    Comment #17186562

    To elaborate on a few of your remarks/questions. > At first glance, Rust's `enum` looks safer and more powerful than Zig's `union` + `enum`, while Zig's `union` + `enum` appears mo…

  15. comment
    Comment #17184929

    Zig is memory-safe if you keep runtime checks enabled (e.g. with debug or release-safe optimization levels) but it does not have the compile-time guarantees of Rust. I don't think …

  16. comment
    Comment #17058141

    It certainly isn't out of reach to get a fairly close speed to GMP implementation-wise if you are willing to optimize the low-level loops in assembly. I think the simple cases are …

  17. comment
    Comment #16227286

    Memory is manually managed, yes. We do have defer (as in go) for slightly easier resource management. Zig doesn't have a default memory allocator. Allocators instead are expected t…

  18. comment
    Comment #16227182

    #include #include typedef struct { int32_t a; int32_t b; } Foo; int main(void) { uint8_t array[1024]; memset(array, 1, sizeof(array)); Foo *foo = (Foo*)(&array[0]); foo->a += 1; } …

  19. comment
    Comment #15496833

    There was, but it was removed in LLVM 3.1 [1]. It seems as there have been some attempts to revitalize it [2] but these are targeting older versions and would probably require a lo…

  20. comment
    Comment #15196961

    Not with the builtin error type. Its pretty much analogous to a c error code. If you wanted to send data you would need some other means like you suggest. I'd be interested in find…

  21. comment
    Comment #15196852

    Yes you have it right, `unwrap()` is equivalent to `%%`. It will panic if the result is an error. Error values under the hood are just unsigned integers and are returned on the sta…

  22. comment
    Comment #15196752

    A useful thing of this is also the portability story. Go for example is pretty good as far as I'm aware of cross-compiling to a different target. The main problem would probably be…

  23. comment
    Comment #15196664

    I've been writing a fair bit since a few months ago, and have written a few things for the stdlib. Here are some examples I like about it. Hassle-free error management Consider you…

  24. comment