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

seems pointless to extract `handle_suspend` here. There are very few reasons to extract code that isn't duplicated in more than one place; it's probably harder to read to extract the handling of the event than to handle it inline.

I strongly prefer this sort of code:

```

    fn does_a_many_step_process():

         first_step_result_which_is_not_tied_to_details_internal_to_the_step_implementation = well_named_first_step_which_encapsulates_concerns();



        second_step_result_in_same_manner = well_named_second_step_which_encapsulates_concerns();

  ...etc
} ```

The logic of process flow is essentially one kind of information. All the implementation details are another. Step functions should not hide further important steps - they should only hide hairy implementation details that other steps don't need to know about.


One huge one is so that you can test it in isolation.

There's extraction for reuse and then theres extraction for readability/maintainability. The second largely comes down to personal taste. I personally tend to lose the signal in the noise, so it's easy for me to follow the logic if some of the larger bits are pushed into appropriately named functions. Goes to the whole self commenting code thing. I know there's a chunk of code behind that function call, I know it does some work based on its name and args, but I don't have to worry about it in the moment. There's a limit of course, moving a couple lines of code out without good cause is infuriating.

Other people prefer to have big blocks of code together in one place, and that's fine too. It just personally makes it harder for me to track stuff.


fair enough, I suppose

I still don't understand how they managed to make a build system as bad as Gradle. It's like they tried to make it as horrible as possible to use.

Yes, every time I fire up an old Android project it needs to download 500MB just for gradle upgrades. It's nuts.

sure, but when I've written zig this has never been an issue for me. `defer` makes memory management really easy.

If you want to auto-generate destructors, zig has really good comptime features that can let you do that.


defer is still something you have to consciously put in every time so it destroys the value semantics that C++ has, which is the important part. You don't have to "just write defer after a string", you can just use a string.

The 'not a problem for me' is what people would say about manual memory in C too. Defer is better but it isn't as good as what is already in use.


I'm not sure why you shouldn't make your compiler accept CRs (weird design decision), but fixing it on the user-side isn't exactly hard either. I don't know an editor that doesn't have an option for using LF vs CRLF.

The unused variable warning is legitimately really annoying though and has me inserting `_ = x;` all over the place and then forgetting to delete it, which is imo way worse than just... having it be a warning.


I don't know an editor that doesn't have an option for using LF vs CRLF.

And I don't know any other languages that don't parse a carriage return.

The point is that it was intentionally done to antagonize windows even though they put out a windows version. Some people defend this by saying that it's easy to turn off, some people defend it by saying windows users should be antagonized.

No zig people ever said this was a mistake, it was all intentional.

I'm never going to put up with behavior like that with the people making tools actively working against me.


> And I don't know any other languages that don't parse a carriage return.

fair enough.


We've had machine translation for a while and I don't think anybody particularly thinks of it as a bad thing? Writing something and then having a machine directly translate it (possibly imperfectly) is a lot different than a machine writing the thing.

Personally I would like people to try learning other languages more (it's hard but rewarding) but you can't learn every language ever, and it is really hard to learn a language to fluency.


> We've had machine translation for a while and I don't think anybody particularly thinks of it as a bad thing?

Not all, but some machine translators can be comically (if not horrifically) bad sometimes. Search Twitter-become-X for examples. Native writers can't pick a working machine translator unless they are explicitly allowed to do so themselves.


The WASM component model is really cool in that you can export basically anything as a component and use it in basically anything else that can compile to WASM and understand components.

I would love something like this for native applications; I'm so tired having to wear C's skin every time I want to do bind together code written in different languages.


I disagree. That's how WASM is now, and I guess that's fine, but that's not all it could be. I really think it would be awesome if you could write code for the web in your preferred programming language.

webassembly components use a borrow checking model[1], so I assume that would be used to manage DOM components?

I'm not exactly sure how this works when binding it to GC languages.

[1] https://component-model.bytecodealliance.org/design/wit.html...


Proving the point of how it is dominated by Rust folks.

Maybe they should have spent some time wondering how previous component models work, e.g. COM, CORBA, RMI, .NET Remoting,....


This is my main confusion, too! I have an existing Wasm GC language implementation and I'm not sure how to reconcile it with the component model.

I would think you could treat it as a normal GC reference and then just drop the resource when the GC collects the object.

iirc webassembly components need to explicitly import anything they use, so it should be transparent which dependencies something has by just grepping its WIT for `import`

I wonder what a 'mixed model' would look like (e.g. is it even possible), e.g. an application which wants to call into component model APIs, but at the same time also needs to call into JS code which then accesses the same APIs. This hybrid model will definitely be needed for any non-trivial web application.

you can just expose javascript functionality as a component, if need be

what's with people inventing new torment nexuses every few weeks? could you people just chill, please?


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

Search: