Readit News logoReadit News
cturtle commented on Lua 5.5   lua.org/versions.html#5.5... · Posted by u/km
cturtle · 3 months ago
One of the new features I found interesting, declarations for global variables, is buried in the reference manual. Here's a link to the section that discusses it: https://www.lua.org/manual/5.5/manual.html#2.2
cturtle commented on Organic Maps: An open-source maps app that doesn't suck   hardfault.life/p/organic-... · Posted by u/ryukoposting
cturtle · 2 years ago
I love Organic Maps! I don't use it for driving, but I do use it regularly for hiking. It is reassuring to know that even if I don't have service I can open the app and can check to see if I'm still on the trail. Highly recommended! I'll have to try navigation sometime.
cturtle commented on Ask HN: Any interesting books you have read lately?    · Posted by u/theycallhermax
spoiler · 3 years ago
The Cradle series by Will Wight. It's a Wuxia adapted for Western audiences. He has other great series; I liked the parallel Sea/Shadow trilogies a lot. Traveler's Gate series I enjoyed, but not as much as the rest. He recently also started a new series called Last Horizon; it's about space wizards and it's a bit whimsical, but fun.

The Expanse series is great, but I reckon people already mentioned it elsewhere in the thread.

James Islington's Licanius trilogy is one of my favourite fantasy book series probably. He recently started a new series called Hierarchy, which I also recommend. They're very "grounded" fantasy, and the magic systems is very woven into society and its structure. The human relationships in his books are pretty nuanced, which is why I like his works so much.

cturtle · 3 years ago
It’s not often I come across someone familiar with Islington. I also highly recommend his books, The Will of the Many is my favorite read this year.

I keep hearing good things about Cradle, I’ll have to give that a read.

cturtle commented on Zig now has built-in HTTP server and client in std   github.com/ziglang/zig/bl... · Posted by u/huydotnet
latch · 3 years ago
I just tried it out and it's very slow. Using `wrk` to hit a basic endpoint that just prints "hello", I got ~500 req/sec. Using a third party zig implementation, I got ~175000 req/sec.

It's also both cumbersome to setup and use.

Before learning Zig, I used to think Zig needed an http server in the standard library. After using it for a few months, and watching this implementation get added, I think it's a mistake - there just isn't enough bandwidth to support a _quality_ kitchen-sink included stdlib.

cturtle · 3 years ago
Maybe you compiled in Debug rather than a Release mode? There is also definitely enough time before Zig reaches 1.0 to improve things.
cturtle commented on Zig now has built-in HTTP server and client in std   github.com/ziglang/zig/bl... · Posted by u/huydotnet
tills13 · 3 years ago
why does _literally_ every line start with "try"?
cturtle · 3 years ago
In addition to the other answers, this is the most logical way to handle most errors in this specific type of code. The http code in the Zig standard library doesn’t know how the programmer wants to handle all the errors, so it uses try to bubble up any error it doesn’t know how to handle.

Why so many uses of try? Because Zig is all about readability, and anytime you see try you _know_ that the called function can possibly fail.

cturtle commented on A different approach to fuzzy finding   nathancraddock.com/blog/2... · Posted by u/todsacerdoti
stinos · 3 years ago
Have you considered submitting this idea as a patch for fzf (like with a flag to switch syntax)? fzf author seems fairly strict/holding back about what goes in and what not, but it seems worth an attempt: thing is fzf can do a lot, is pretty well architected, many features are really neat, and it seems less work to patch it than to start from scratch.
cturtle · 3 years ago
No I hadn't considered that. I wouldn't be against my "zf algorithm" being ported to other tools though. But when I first had the idea for zf I had just learned Zig and it seemed like the perfect way to practice with my new language.
cturtle commented on A different approach to fuzzy finding   nathancraddock.com/blog/2... · Posted by u/todsacerdoti
krobelus · 3 years ago
> Notice that both fzf and fzy ranked source/blender/makesdna/DNA_fileglobal_types.h higher than GNUMakefile. I believe this is because /make and _file in that path are on word boundaries and are ranked higher than UMakefile that is not on a word boundary.

The reason for prioritizing word boundaries is so that you can type "sln" to match "SomeLongName". So while you are improving one use case you are probably breaking another one. I'm not sure how VSCode ranks GNUmakefile first, maybe they prioritize exact substring matches. It's still a heuristic that can fail. The ugly part is that it's not part of the "best match" algorithm that finds a global optimum.

> It first attempts a match on the filename. If there is no match, it retries on the full candidate string

Kakoune does the same, see https://github.com/mawww/kakoune/blob/019fbc5439ad884f172c32...

> Strict path matching means that the path segments of the query token cannot overlap between path segments in the candidate.

nice

cturtle · 3 years ago
> Kakoune does the same

Great! I’m glad I’m not the only one to have thought of this simple idea :)

cturtle commented on A different approach to fuzzy finding   nathancraddock.com/blog/2... · Posted by u/todsacerdoti
ithrow · 3 years ago
Looks like the author doesn't know about FZF's different search syntaxes https://github.com/junegunn/fzf#search-syntax

If they had left quoted the word makefile, GNUmakefile would have been the first result.

cturtle · 3 years ago
Author here! I’m aware of the FZF search syntaxes. They are very useful! I designed zf to be a small tool that worked a bit better for me by default without special syntaxes.
cturtle commented on Zig's multi-sequence for loops   kristoff.it/blog/zig-mult... · Posted by u/kristoff_it
andrewstuart · 3 years ago
>> Zig is exactly what I want out of a language though

What is exactly what you want from a language?

cturtle · 3 years ago
I value simplicity and control.

Zig is a very consistent language in syntax and semantics, so there are a small number of features I need to be concerned with. My understanding is that once Zig reaches a stable 1.0 the language will not change. Although there is a lot of churn right now, I appreciate the idea of a language that is simple, and stays simple.

The code is also very readable. I haven't found another language (yet) that I can just open up the standard library source code and understand just about everything. With no hidden control flow I can easily read a function and not have to question what a line of code does. Everything it does is right in front of me.

I also love that Zig is trying to fix many of C's problems. Rather than a global libc allocator, each function that can allocate (by convention) accepts an allocator as an argument. In my projects this has been really great for understanding what code paths allocate, which has made it easy to package my fuzzy finder as an allocation-free Zig module and C library.

Now, if I were working on a project with more critical safety requirements, I might consider a different language. But for most of my personal projects Zig is exactly what I need.

cturtle commented on Zig's multi-sequence for loops   kristoff.it/blog/zig-mult... · Posted by u/kristoff_it
andrewstuart · 3 years ago
Off topic, but I was weighing up trying Zig last night for a project.

No doubt Zig has changed alot and is better than it was only a year or two ago.

Is anyone here willing to say if they have experienced success and satisfaction using Zig? I'm wanting to do some C library interfacing.

cturtle · 3 years ago
I’ve absolutely had satisfaction with my several personal projects written in Zig. And based on an imperfect measurement (GitHub stars) I have also had moderate success in making something useful. It’s a terminal fuzzy finder [0]. I also maintain a Zig Lua bindings package [1], and I’m working on a port of an old Macintosh game [2].

Zig is exactly what I want out of a language though, so take my opinion with a grain of salt :)

[0]: https://github.com/natecraddock/zf

[1]: https://github.com/natecraddock/ziglua

[2]: https://github.com/natecraddock/open-reckless-drivin

u/cturtle

KarmaCake day318June 7, 2020View Original