Earlier quoted context omitted.
Syntax is so much less important that semantics that it isn’t even really worth talking about in my opinion
Readability (in the sense of "How fast can the average developer parse code in the given language?") and proneness to errors are a thing, though. Consider, e.g., how in TypeScript object literals ({ a: b, c: d, e }), object types ({ a: b; c: d; }) and object destructuring ({ a, c, e } = … ) can all look very similar. Same thing for lambdas ((a: b) => b) and function types ((a: b) => b). Also, additional parentheses a…
Show HN: Zig Topological Sort Library for Parallel Processing
21–30 of 48 posts
Re: Show HN: Zig Topological Sort Library for Parallel Processing
#22Earlier quoted context omitted.
Just wanted to say that Rust may look strange early on but very, very quickly becomes entirely natural, so don't let that be the reason why you haven't learned it is my unsolicited input
Yeah, I just haven't needed the memory safety that comes with it and I don't have the same gripes everyone else has with c's include system. At this point it just doesn't have anything to offer that I really care about. I only learned zig because of the comptime stuff and some ease of use when it came to tls encryption. I'm a little interested in rust macros, but that's really it and I don't think that's enough to le…
For what it's worth, I use Rust daily and I don't really care about memory issue. It's nice that it comes with the package, but it's not why I do it. Believe it or not, the borrow checker is first and foremost why I enjoy writing Rust. It's such a brilliant idea I don't understand why it's not more widely used. A helpful compiler and a good (if imperfect) crate ecosystem are probably 2nd and 3rd.
Re: Show HN: Zig Topological Sort Library for Parallel Processing
#23Re: Show HN: Zig Topological Sort Library for Parallel Processing
#24Earlier quoted context omitted.
Readability (in the sense of "How fast can the average developer parse code in the given language?") and proneness to errors are a thing, though. Consider, e.g., how in TypeScript object literals ({ a: b, c: d, e }), object types ({ a: b; c: d; }) and object destructuring ({ a, c, e } = … ) can all look very similar. Same thing for lambdas ((a: b) => b) and function types ((a: b) => b). Also, additional parentheses a…
Sure but I don’t think those examples really matter once you establish basic familiarity with a language. The semantics and constructs a language provides are much more important and debating syntax is missing the forest for the trees
Re: Show HN: Zig Topological Sort Library for Parallel Processing
#25I really like this, this is the perfect size project for exploring a new piece of tech. I especially like that you implemented an actual cli and not just tests.
Re: Show HN: Zig Topological Sort Library for Parallel Processing
#26Earlier quoted context omitted.
Sure but I don’t think those examples really matter once you establish basic familiarity with a language. The semantics and constructs a language provides are much more important and debating syntax is missing the forest for the trees
The array syntax is very offensive: `const a = [3]i32{ 1, 2, 3 };` A set is denoted by braces, not an array.
I find the rust equivalent much more intuitive `let a: [i32; 3] = [1, 2, 3];`
Re: Show HN: Zig Topological Sort Library for Parallel Processing
#27For example, with this input:
$ cat data.file
root: parentA parentB
parentA: C D
parentB: E F
Asking the package tool for the sorted sets gives me: $ ./zig-out/bin/toposort-cli --data data.file
Processing succeeded.
Topologically sorted sets: [ { C D E F } { parentA parentB } { root } ]
Topologically sorted list: [ C D E F parentA parentB root ]
Nodes: [ root parentA parentB C D E F ]
Dependency tree:
[ C D E F ]
C -> [ parentA ]
parentA -> [ root ]
root ->
D -> [ parentA ]
parentA -> [ root ]
root ->
E -> [ parentB ]
parentB -> [ root ]
root ->
F -> [ parentB ]
parentB -> [ root ]
root ->
If we follow the README's advice to parallel process set-by-set, we can easily have starvation: once `C` and `D` are finished, we are ready to start `parentA`, even if E and F are still work-in-progress.How would I use the API of this package to detect and start the task `parentA` as soon as `C` and `D` are finished? I guess when a task is finished, I can ask for the list of dependent tasks, and for each of them, check if all of their dependencies are finished, and if so start the task. But this real-world need feels un-met; it feels odd to me to focus on the sorted sets instead of more practical scheduling.
That is kind of doing Kahn's algorithm iteratively during the build. It would be cool to try and optimize that for maximum performance.
Re: Show HN: Zig Topological Sort Library for Parallel Processing
#28Earlier quoted context omitted.
The array syntax is very offensive: `const a = [3]i32{ 1, 2, 3 };` A set is denoted by braces, not an array.
This is exactly why I find the language unintuitive. I don't understand why they made the choices they made. For example, why curly brackets? I find the rust equivalent much more intuitive `let a: [i32; 3] = [1, 2, 3];`
Re: Show HN: Zig Topological Sort Library for Parallel Processing
#29Earlier quoted context omitted.
Could you describe briefly what feature you are sorely missing? I like the language intention but I can't get past the syntax.
For me it's all comptime stuff and it's kind of arbitrary things like parsing out the type information of a function doesn't include the name of the function parameters, but basically everything else that has a name has that information present in their info structure. The other thing is tags, being able to tag things that I can parse at compile time. I'm making something close to a database orm, (specifically it's s…
I totally understand how those two features could be useful.
For the parameter name feature, I can't imagine a strong reason for not implementing it (I mean, apart of "we have other stuff to prioritize").
For the tag I could see an attribute system like in C++ [0]
On a tangential topic, I believe that's exactly the Pandora box of meta-programming.
[0] https://en.cppreference.com/w/cpp/language/attributes#Explan...
Re: Show HN: Zig Topological Sort Library for Parallel Processing
#30Earlier quoted context omitted.
Sure but I don’t think those examples really matter once you establish basic familiarity with a language. The semantics and constructs a language provides are much more important and debating syntax is missing the forest for the trees
The array syntax is very offensive: `const a = [3]i32{ 1, 2, 3 };` A set is denoted by braces, not an array.