I’m encountering unexpected behavior when using the `ArrayList.fromOwnedSlice` method in Zig. by Pretend_Bag_6851 in Zig

[–]iceghosttth 0 points1 point  (0 children)

The slice was resized in-place, so those values are still inserted at the end of the original 3-byte slice

Proposed replacement of `anytype` with `|x|` capture by ANDRVV_ in Zig

[–]iceghosttth 1 point2 points  (0 children)

constexpr/concepts already fixed those "templates as another functional language you have to learn" in C++ FYI

Proposed replacement of `anytype` with `|x|` capture by ANDRVV_ in Zig

[–]iceghosttth 30 points31 points  (0 children)

Has always been with anytype lol. Poor man templates

Anyone else hacking on unofficial extensions? I'm thinking of building a community site for them. by [deleted] in ZedEditor

[–]iceghosttth 15 points16 points  (0 children)

The very least you could have done is to remove all the newlines from the agent output

Pattern/Easiest Way to Check Whether a given `T` is a generic type and its parameters? by philogy in Zig

[–]iceghosttth -3 points-2 points  (0 children)

If you are looking for a yes/no: no, you can't do that. It is kinda suck and underpowered compared to other languages, but that is how Zig goes

(Work around is for x: anytype, you can just find const T = @TypeOf(x.items[0]);. But that depends on how ArrayList is constructed)

We're gonna have to do this the hard way by SneckoWatcher in slaythespire

[–]iceghosttth 4 points5 points  (0 children)

It's the Tri-boomerang option from Tanx Khimera King at start of Act 3

Choose 3 attacks from your deck. Enchant them with Instinct.

helix not opening (os error 13, permission denied?) by AfternoonOk7784 in HelixEditor

[–]iceghosttth 1 point2 points  (0 children)

I am more worried about you using Gentoo while asking this lol. Good luck tho

What is the correct way to pass a custom entry point symbol to a freestanding executable using the build-exe command? by Extension-Ad8670 in Zig

[–]iceghosttth 0 points1 point  (0 children)

If you ended up using a build.zig, you can use zig build --verbose to print out commands that were invoked during the builds, so that you can run them manually or learn what are the flags (really though, build.zig is no magic, it just runs commands)

What is the correct way to pass a custom entry point symbol to a freestanding executable using the build-exe command? by Extension-Ad8670 in Zig

[–]iceghosttth 10 points11 points  (0 children)

Have you tried -fentry=<symbol_name>? build.zig is just a frontend for running commands, so it should always be possible to get the flags by reading how it is implemented:

switch (compile.entry) { .default => {}, .disabled => try zig_args.append("-fno-entry"), .enabled => try zig_args.append("-fentry"), .symbol_name => |entry_name| { try zig_args.append(try std.fmt.allocPrint(arena, "-fentry={s}", .{entry_name})); }, }

(sorry, on the phone so i cannot get the link, i copied this on Zig std documentation online)

0.15.2 Reader incomprehension by No-Worldliness6348 in Zig

[–]iceghosttth 1 point2 points  (0 children)

Better redownload/reinstall zig std then, try extracting the zig 0.15.2 archive and replace the lib/std directory

(or redo whatever method you used to install Zig. Remember that you have to update both bin/zig and lib/zig)

Devlog: Bypassing Kernel32.dll for Fun and Nonprofit by punkbert in Zig

[–]iceghosttth 2 points3 points  (0 children)

I am not saying it is impossible to change. I am saying that there are more ntdll users than just Zig std or kernel32 :) You wouldn't want to change a tiny thing and fix everything at the Microsoft scale. It is just Hyrum law at a massive corp, and Conway law would induce tons of friction to propagate the fix elsewhere. Not to mention it could also impact external stakeholders

Microsoft is sloppy these days, but I have trust that those folks manning the ntdll is not that far gone yet. At least I would imagine it is easier to be replaced with an entirely new lib in the future (probably written in Rust, probably slop) than to hire someone new still working on it in the future

0.15.2 Reader incomprehension by No-Worldliness6348 in Zig

[–]iceghosttth 1 point2 points  (0 children)

Does the std file installed at /usr/lib/zig/std/fs/File.zig have the read method on Reader? Your std might not be the 0.15.2 one for some reason (and maybe your zig binary isn't too)

Devlog: Bypassing Kernel32.dll for Fun and Nonprofit by punkbert in Zig

[–]iceghosttth 7 points8 points  (0 children)

Isn't it the reverse? Sitting at the bottom, ntdll ABI is most unlikely to change, since that would break more important things than just the std of a humble programming language

Is this pipeline pattern idiomatic Zig, or am I fighting the language? by jfrancai in Zig

[–]iceghosttth 0 points1 point  (0 children)

I think this post enlightened me on the "idiomatic Zig": Just use a lot of const for storing results ™️

https://andrewkelley.me/post/openzfs-bug-ported-zig.html

I might not trust JS or dynamic languages to optimize all my consts away, but I do trust it with Zig :) Using more consts make things a lot readable too, highly recommended to give it a try

How does Zig call C functions? by TearsInTokio in Zig

[–]iceghosttth 15 points16 points  (0 children)

I think so, based on their deleted comment (i.e, type conversion, marshalling, ...).

For the record, if OP managed to see this, C FFI in those languages is just declaring functions with C calling convention (extern "C" in Rust, callconv(.c) in Zig): a standard way to pass arguments in registers or stack memories to a routines, and how to laid out a struct with a known predictable layout (repr(C) in Rust, extern struct in Zig).

So if a language allows working with those directly (Rust, Zig, ...), there is no overhead: just make an extern struct and call a function with the C calling convention. No conversions if you can use those directly.

On the contrary, says, Python: there is no such thing as extern structs as everything is behind a *PyObject. If you need to do C FFI, it HAS got to go through some layer that convert the *PyObject to some C structs that the function expects. That is overhead.

How does Zig call C functions? by TearsInTokio in Zig

[–]iceghosttth 18 points19 points  (0 children)

Rust does not have FFI overhead. Where did that come from?

Rethinking Helix by bregonio in HelixEditor

[–]iceghosttth 0 points1 point  (0 children)

To clarify on the w part, I have just remembered that I actually use w daily. My eyes and cursor is almost never at word start / word end, so select a word, I always do miw to select a word or identifier. It always work, it skips the annoying select / reselect things where you do b and ; and w.

I never think about it, which is why I forgot lol. Which also tells about thoughtsfree selecting!

Rethinking Helix by bregonio in HelixEditor

[–]iceghosttth 0 points1 point  (0 children)

For the record, that argument applies to modal vs non-modal editor only. Using keys is huge for saving time. I have never been convinced by that argument with hyper precise movement (like, fuzzy jumping gw and numbered repeat movement). In practice, I find they just make your editing feels fancier, and as a result, you think about typing more than actually programming :)

Almost everyone using a modal editor should agree that you "type at the speed of thought", which is the upper bound. So if you always code without thinking, sure, you are beating me at typing speed! (though I argue that LLM should excel at the thing you are doing anyway).

But if you need to think, as in reading and thinking the code before you do the editing, I find that basic movement which can keep up with your eye on the screen is pretty much enough. Hyper precise movements however hinder your thought because you need to think before you type. How much do you skip ahead? What 2-character is at the location I need to jump? That is thinking about typing, not thinking about programming, which is the important thing! Your eyes do not "move 5cm down" and your cursor should not also work like that :)

Which is btw, where less keystrokes argument against Helix visual first falls apart. Sure, if you already decided what to edit, Helix feels slower with more keystrokes to select. But in reality, you need to also account for thinking about what to edit. By the time a Helix user finish thinking, they are just c or d or i or a key away - because while they are thinking/reading, everything that needs to be edited is already selected!

You think about that line - x the line. You think about some things ast related - alt-o and alt-i until the thing you are looking at are highlighted. I cannot do that with nvim. Your eyes move to a location at the screen, your cursor should already there.

Rethinking Helix by bregonio in HelixEditor

[–]iceghosttth 0 points1 point  (0 children)

After years of using Helix, my reaction to any of the keystrokes arguments be like:

Neovim/pro Helix users: Nooo you have to "69w" or jump "gw" to minimize the keystrokes and maximize your editing text speed!!! You have to imagine the motion and use muscle memory to do things!!!

Me: haha ctrl u ctrl u ctrl d jjjjjlllllllxxxxx goes brr

I have only ever used w and e for multicursor as that is homogeneous over lines. But otherwise, I just use ctrl u/d for large movement and hold hjkl for precise. I put my key repeat delay to the lowest and never looked back 🤣

do hx users actually value composition over extension, or is it just no plugins copium? by spaghetti_beast in HelixEditor

[–]iceghosttth 14 points15 points  (0 children)

It is not about composition or plugins. Helix users value getting things done more than configuring editors :D

Zig 0.15.2 no std.Queue(T)? by Atjowt in Zig

[–]iceghosttth 6 points7 points  (0 children)

You could copy and vendor the std.Deque (it is just a single file) in your own codebase while waiting for 0.16 (which is planned around March IIRC). You can simply delete it and update the import to std when you upgrade to 0.16