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

There is also https://UpCloud.com


Oh well, maybe we'll soon have `defer`? [0]

[0] https://thephd.dev/c2y-the-defer-technical-specification-its...


That's sad. Having migrated from C++ to golang a few years ago, I find defer vastly inferior to C++ destructors. Rust did it right with its drop trait, I think it's a much better approach


The proposed C defer is scope-based unlike Go. So in the spirit of OP article, you can basically hand roll not only C++ destructor as defer {obj.dtor()} but also Rust Drop as defer {obj.notmoved() ? Drop()}


What do you mean defer isn't scope based in Go?

(not super experienced Go developer)


In Go, defers are function scoped not block scoped.


I mean, you just write all your scopes as `(func() { })()` in go, and it works out fine.

Adding `func() {}()` scopes won't break existing code usually, though if you use 'break' or 'continue' you might have to make some changes to make it compile, like so:

https://go.dev/play/p/_Gq4QYtyMmp

see, no other issues, works exactly like you'd expect


Right, that makes more sense.



Although that is true, the author has expounded at lengths on the unsuitability of RAII to the C programming langage, and as a big fan of RAII the explanations were convincing.


Even Zig which is extremely against "Hidden control flow" (so no operator overloading, etc.) added in the "defer" feature.


Destructors/drop have issues though:

* cannot return errors/throw exceptions * cannot take additional parameters (and thus do not play well with "access token" concepts like pyo3's `Python` token that proves the GIL was acquired -- requiring the drop implementation to re-acquire the lock just in case)

I think `defer` would be a better language construct than destructors, if it's combined with some kind of linear types that produce compiler errors if there is some code path that does not move/destroy the object.


What's "drop trait" for C? There are no any traits in C.


Parent post said Rust.

edit: TIL: Looks like the [drop trait][1] is an opt-in destructor that the Rust compiler understands.

[1]: https://doc.rust-lang.org/nomicon/dropck.html


I was wondering if the beta checkbox the same thing as setting the ActiveCodePage to UTF-8 in the manifest, but the docs[0] clarify that GDI doesn't adhere to per-process codepage, but only a single global one, which is what the checkbox sets.

Bit of a shame that you can't fully opt-in to be UTF-8 with the *A API, for your own apps. But I think for the issues highlighted in the post, I think it would still be a valid workaround/defence-in-depth thing.

[0] https://learn.microsoft.com/en-us/windows/apps/design/global...


Hmm, it says

> Shipping to Switzerland only

which is a shame :/


Hrm. I think I had few OS/2 boxes amongst some old games I took to sell to a video game antiquarian, and I think I left it there but they didn't seem interested in them.

Frankly I don't remember which language they were, either english or finnish. I had both the red and blue boxes (was it, with windows support or not?), and other was unopened.

I usually preferred english versions myself, as I learned computers with english, it was more comfortable with me. Also IBM had some rather odd choices on some words versus Microsoft, which could be jarring (was it Umpilevy for hard drive, as opposed to Kiintolevy or Kovalevy in most other places).

One year (must of been 1997 or so?) IBM had a crazy marketing campaign at Assembly[0], where they practically just handed out the boxes to anyone who would take them. If they had handed out finnish version, I would be surprised if they were that hard to come by.

[0] https://assembly.org/en


Is the term "Barrel file" somehow in common use? I've never heard of it (not a js dev though). I would expect some kind of "umbrella file", "public interface", "reexport facade", or something along those lines.


Yes it's common terminology in the modern js/ts ecosystem. It makes sense because your gathering modules into a single "barrel". We already have plenty of gang of four word vomit terms we don't need anymore.


yes, it is


I think the referenced Tim Wright interview is this[0] one

[0]: https://www.youtube.com/watch?v=2CGhBLHfP_M


I find my self disagreeing quite strongly, I would hate that default :/

I find all kind of code folding massively throws off my spatial sense of the code. And if I'm browsing random code, then I often need to see the body too, to see if this is the place the work is done, or is it behind some abstraction down the line.

Perhaps I don't need it as much on c++ codebases, as the headers in a sense are that already. And Rust codebases I've dabbled in haven't been quite that big or overwhelming.

The outlineview/(the popup on top of buffer in many editors that lists the outline) is enough to finding my place in a file I feel lost. And if just looking how to use a lib, there is often some API documentation that helps along finding the right things (even if just barebones doxygen or rustdoc).

I'm sure this is as much of a habit thing as other editor preferences. Still I find it surprising how many people like code-folding :)


> I would hate that default

The default, as made clear in the article, would be to do nothing different than today. This describes an optional feature.


I was reading 3dica[0], though I was too young or stupid to really grok it back then.

[0] https://www.modeemi.fi/drdoom/3dica/3dica.htm


Such is the years long removal of affordance from the UI. Netscape 4 had a small downwards arrow to indicate a submenu for the backbutton.


On Firefox it apparently disappeared in 2011

https://github.com/black7375/Firefox-UI-Fix/wiki/%5BArticle%...


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

Search: