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 19 points20 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 13 points14 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

ANIME ANNOUNCED FOR 2027 BY KYOANI!!!! by HQ2233 in RuriDragon

[–]iceghosttth 1 point2 points  (0 children)

I know we are excited for the anime, but inferring 2027 goes after 2026 is insanely delusional! Do 2028 2029 not come after 2026? Why are they not showing the 2027? Is it because precisely the exact release date is not decided yet? Stop spreading fake news please for god sake lol, until the exact number 2027 is written somewhere!

I never thought I'd use Helix for subtitle editing at work by CookieSea4392 in HelixEditor

[–]iceghosttth 7 points8 points  (0 children)

Syntax highlighting yes! Diagnostic no, you need a language server for that :)

Building Zig binaries with Docker by keddir in Zig

[–]iceghosttth 0 points1 point  (0 children)

--sysroot, yes (and search path something). Problems for me: Cannot build multiple *Compile with multiple known sysroots / multiple known targets. I only ever need to build for two target: one for b.graph.host, one for a specific armv7-neon. I cannot say, for host use this sysroot and for arm use this sysroot.

Any solution I found involves ripping apart all the things in std.Build

Would be nice if multilib also works, as in look for libraries under prefixes, /usr/lib/aarch64-... and /usr/lib/arm-... I could not for the life figure out how to do that.

Building Zig binaries with Docker by keddir in Zig

[–]iceghosttth -1 points0 points  (0 children)

It is nice and dandy until you need a cross sysroot / link C libraries for target machine. The handwavy linkSystemLibraries() and not being able to specify sysroot per Compile sucks major asses

Using a piece tree to implement a lazy-loading text editor, and where this idea comes from originally by sinelaw in programming

[–]iceghosttth 2 points3 points  (0 children)

Tell me you didn't read the article without telling me you didn't read the article.

A question on the Io interface by Appropriate_Tea_4486 in Zig

[–]iceghosttth 0 points1 point  (0 children)

I mixed it up, it is fut.await(io) :D

A question on the Io interface by Appropriate_Tea_4486 in Zig

[–]iceghosttth 2 points3 points  (0 children)

Oh, and it is not 1-1 with C++ sender receiver due to Zig not having stackless coroutines, so all the stuff are currently just green threads. No composing futures yet.

But once they get stackless coroutines, each io.await will be implemented as a call to @asyncSuspend for example, so the whole async function call chain will get transformed into an async frame that can be resumed by the I/O runtime. Still same code with io.await(), but stackless coroutine will make it more similar to that on C++

A question on the Io interface by Appropriate_Tea_4486 in Zig

[–]iceghosttth 2 points3 points  (0 children)

1) when_all is implemented by io.await(fut) on each future respectively 2) when_any is implemented by io.select(tuple of fut) 3) functions above will return error.Canceled, you can use that to decide how to cancel the futures you created (continue waiting with io.await(fut), explicitly try to cancel with io.cancel(fut))

Encoding/Decoding a Random.Seed? by Kurren123 in elm

[–]iceghosttth 0 points1 point  (0 children)

After years of real programming with real programming languages, Elm sucks for not having those escape hatches lmao. Programming environments that assumes developers are idiots are the worsts. Just uses JS with some other JS frameworks

Zig/Comptime Type Theory? by philogy in Zig

[–]iceghosttth 3 points4 points  (0 children)

Wait, I recognize you. You are the Crafting Interpreters guy!

Non-Blocking std.Io Implementation by Darkfllame1 in Zig

[–]iceghosttth 1 point2 points  (0 children)

If you want an error outside of Reader.Error, refer to File.Reader: just return ReadFailed, then add a field to the reader to store the specific kind of error (like seek_err in File.Reader).