HN Simulatornew | past | comments | lists | submit | maleldil's commentslogin

Doesn't that assume there are no intrinsic differences between single-threaded, multi-threaded and async execution? Plenty of code works fine single-threaded but breaks once it's run multi-threaded or async, and some works fine multi-threaded but breaks under async. With explicit async you have precise control over where you yield back to the event loop. With Zig's Io you don't get that unless you deliberately design for it, and at that point you've just got an implicitly coloured function.

There is a difference between single-threaded and multi-threaded, but if you use `io.concurrent` or `io.async`, you are expected to have your code assume multi-threaded enviroment. And there is no visible behavior change between blocking and non-blocking backend, assuming you are not calling external libraries that do their own I/O. So code written and tested on blocking threaded I/O, will work just fine on async implementation. All I/O operations are the yield point.

What's wrong with top-level functions?


The underlying APIs are very similar, but you can't just install an extension from the Chrome Web Store.


And use worse models?


Just wear underwear.


> Guessing others feelings about things also.

Yet you confidently decided that they're not neurodivergent based on a comment?


It literally says:

> Works with JavaScript arrays


Yes but why? Why should I import a giant dependency to do this:

  a = [1, 2, 3];
  foo = effect.Array.append(a, 4);
instead of using what's built in to the language?

  a = [1, 2, 3];
  foo = [...a, 4];


You wouldn't. Effect isn't an array library.


did you read the docs? it says

"Use when you need to guarantee a non-empty result after adding a required trailing value."

...whatever that means lol


The types allow you to very narrowly define functions so that you can, for example, require that a NonEmptyArray be passed. This helps to fulfill that requirement without casts.


NonEmpty is a type that allows you to distinguish between:

    a = [undefined];
    res = a.pop() // undefined

    a = [];
    res = a.pop() // undefined


As a Python person, that 2nd one looks like a bug. Expecting an exception there. Although also Python doesn't have an `undefined`; `None` would have to suffice.


That 2nd one being a bug is exactly what the type system and NonEmpty types is designed to help prevent.


Not really. If you try to take something from an empty container (language or real life) then you should get an error/issue. The container type doesn't change when it's empty, and the operation is just senseless; all that's happening here is added mental gymnastics that makes code unintuitive to read. Checking if/asserting a container isn't empty is a straight forward `if cont: ...` or `assert cont` in Python, which anyone can just get.


The type soft-enforces₁ it immediately for everyone though.

Without the type there are a few possibilities: 1. I could forget the assertion and have buggy code without realizing. 2. I could ensure that all uses do the assertion. Even if we can statically know that it is empty. This costs us the check for every call of the function, and ends up being more code.

Alternatively I could statically know in advance. The code won't let me `Array.pop` because that is invalid, so:

  1. I *cannot* make that mistake
  2. It cost no runtime performance
  3. It cost no extra code in a function
1: I say soft-enforce because if someone were to pass a value incorrectly cast as NonEmpty, it would still have a runtime error, but that is a bug elsewhere, not here.


Right, you can attempt to take and potentially error, but if you already know that taking is possible you can skip the noise and simply return a result. Checking if your container is empty every time you remove an item is not free.


Mano, seu comentário é incompreensível.


reframe:

Brazil will never fully block Facebook. WhatsApp and Instagram are the most used apps, with TikTok being their only relevant competitor. However, the Brazilian government recently blocked Meta from controlling payments, similar to the EU's Gatekeeper rules. While this is certainly a right-versus-left issue, it is about much more than that—it is a struggle involving civil society and the working class. Social media is the new press, and society is being manipulated.

Of course, people need to understand every angle; if you think Company A or Governor B is entirely good, you are being manipulated. I strongly dislike this censorship surrounding Lula, but it's important to understand that this is retaliation for the government attempting to regulate certain global aspects.


So you recognise that today the pervert issue is real?


Yes, but Rust gets you both.


Sure. I like Rust. But i also know when not to use Rust.


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

Search: