Hacker Newsnew | past | comments | ask | show | jobs | submit | ulbu's commentslogin

calling what someone else finds interesting “not an interesting measure” is itself something that calls for an interested measure.


|capture| hides an inconsistency that bugs me – everywhere else, assignment to a variable flows leftwards. |capture| is an unnatural rightwards assignment.

in general, I like zig syntax, but i find that it had very little regard to how the eye moves on the page. it’s jarring at times.


But the capture is conditional so it makes sense.

if (evaluation) result = evaluation

if (evaluation) |result|

Although assignments as expressions in C are convenient, I don't think they make a ton of sense and find Zig's capture easier to read (easier to immediately see what's being evaluated)


if |result| (evaluation)


I think you could argue for it both ways. Then you could claim ternaries are inconsistent too, shouldn't it be:

resultA : resultB ? (evaluation)

if we always put result first?

I think the most important piece of if statements and ternaries is the condition being evaluated and it's worth putting that first?


but zig has no ternaries, so it does not apply to a discussion about zig’s syntax.

and ternary is a branch with no variable introduction, so it doesn’t apply again.

(it’s basically a weak switch expression, and the value moves leftwards towards its invocation.)


I think they mean red as a shell scripting/command line language.


All that shell scripting needs is the ability to spawn processes and connect their stdin/out/err together. Or at least, that's what distinguishes "scripting" from "shell scripting". Obviously, you can write a library (I like Python's Plumbum) in almost any language you like that provides this functionality conveniently. So, again: yes, Red can be used for that just as well as any other language (and, arguably, it may be better for this use than many others).

For an interactive shell, you also need a REPL, which Red provides. So if you write that library for Red, you get the interactive shell for free.

Yes, Red has many advantages: it can AOT compile to native, it's homoiconic, it has a built-in Parse dialect (so the library can be really ergonomic), the Red executable is tiny and starts up fast, it has native GUI capabilities (if you're in a Red-based shell and want to view an image, it's trivial to create a GUI window and display it there). I'm not saying Red would be a bad choice. I'm just not sure it would be my choice, given the existence of, e.g., Chicken Scheme or Smalltalk/X.


or “sometimes not, until more data arrives”.


C3 is a contender to C++ because of its namespace operator?


you need different packed structs for little- and big-endian data. and casting with little-endian data is a nightmare - you need to reverse-cascade your struct fields to be in accordance with the little-endian bit-pattern. (or have a comptime function that does it for you, of course. but then you lose all declarations for the struct). what should be a simple writing down of a protocol is now a pedantic and error-prone ordeal.


This has been largely solved by everyone agreeing to use little endian. There aren't really use cases for wanting to convert between them.


Does that mean there are no file formats thatbuse big endian? And network byte order isn't a thing?


Generally those edge cases are always the same endianness. You don't need big and little endianness versions of the structures. What's important is that everyone agrees on the same thing.


There are some cursed data formats where something is little endian in some places, big endian in other places

Generally speaking though the types you handle in business logic (what your application actually do) shouldn't have any endianness


    > there are no file formats thatbuse big endian
if someone chooses to do that they own the problems.

    > network byte order isn't a thing
if the network serializes/deserializes for you (kernel primitives) then you don't care what it does. if it doesn't and for some reason you choose to use big endian, again, you own the problem.


Network byte order has nothing to do with the kernel and you have to care about it

It’s a standard because neither side of the connection knows the endianness of the other side so there must be a standard. That standard is big endian regardless of your architecture or kernel or anything else

So any serialization intended go over the network should be big endian


right, so a zig app will just do little endian. in the very unlikely event you have it running on a big endian machine you have to do extra work.


You may have never done socket programming, or do you use wrapper libs in Zig? Because you have to send the kernel big endian port numbers for example.

What do you do if you program a kernel in Zig, or just generally do low level networking?

My point is to refute the statement that everyone has agreed to little endian, and so there aren't use cases to want to do conversion. Programs do not exist in a vacuum, most programs do not.


Well you would, of course, have a mapping layer between wire types and domain types, like in any good codebase. You do the endianness conversion at that boundary, and then you can just send it out.


> You do the endianness conversion

Exactly my point.


And what happens if your zig app happens to be a network driver running on a microcontroller?


If someone chooses to load a TIFF or a PSD or an AIFF or…


then you either use an existing C library (the most likely approach) or if you are determined to re-implement it you have to be careful parsing their bytes.


Or you just go ahead and forget that big endian ever existed. It's not coming back.


it’s little-endian protocols that require that you juggle your struct fields.

plus, there are still big-endian protocols that will stay for a long time. for example, MIDI clip files in MIDI 2.0 are big-endian.


well, it doesn’t say Lua5.1-JIT


evolution is a wrong concept to approach it. cancer is not a separate life form, but a bug in the regeneration system of a complicated life form. it doesn’t exist outside of it, it cannot propagate.


Cancer researchers generally refer to it as evolution, and I've never heard any complaints from the population geneticists or evo-devo folks about it, so I don't think it's a tremendously controversial way to talk about it. See for example

https://www.nature.com/articles/s41586-019-1907-7


You might want to read this

https://en.wikipedia.org/wiki/HeLa


the single celled dog might beg to differ.

sometimes a cancer can then survive on its own back as a single celled organism


I've heard that some cancers spread by viruses. Viruses do evolve. No idea if that says anything about cancer evolving.


Excuse me, but I think zig grows ever better from driving away users who are driven away by flashy headlines and whatever is the opposite of this “activism” you suggest.


the green is from moving the line


actually, they added exclamation


They moved it out of the bullet list in the CLI version, and added it to the web version.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: