Hacker News new | past | comments | ask | show | jobs | submit | ropejumper's comments login

It's a bit big for my hands as well, but the huge touch screen is amazing for programs like sunvox so I don't even mind.

I think it's hard to genuinely appreciate how big the thing is until you hold it. Today I realized it's exactly the same size as my keyboard. And almost as wide as a 12-inch macbook.


The formatting is off, family time is 17:00-21:00 in GP's comment.

On almost every newline, which is the reason why this doesn't work:

    func thing()
    {
I quite like this approach. It's very simple and consistent, and once you know how it works it's not ever surprising.


Because now you have to jump around in order to see the sequence of events, which can be very frustrating if you have to constantly switch between two of these functions.

Plus, if we're dealing with a "long list of tasks" that can't be broken up in reusable chunks, it probably means that you need to share some context, which is way easier to do if you're in the same scope.

One thing I find useful is to structure it in blocks instead, so you can share things but also contain what you don't want shared. So e.g. in rust you could do this:

    let shared_computation = do_shared_computation();
    
    let result_one = {
        let result = do_useful_things();
        other_things(&shared_computation);
        result
    }
    
    ...
I think it's a nice middleground. But you still can't write modular tests. But maybe you don't have to, because again, this is just a long list of tasks you need to do that conceptually can't be broken down, so maybe it's better to just test the whole thing as a unit.


Two people have already mentioned things like storing the length inline or including a null-terminator to be backwards-compatible. What's described there is basically the same as std::string_view or &str, and to me one of the biggest reasons to use these structures is that your particular view of the string doesn't interfere with someone else's. You can slice your string in the middle and just look at it piecewise without bothering anyone else.

Choosing between these trade-offs just depends on what you're doing. I'd definitely choose this pattern if I were to write a parser for instance.


The problem with string views is that they are borrowing the parent string, so you'd need to hold a strong reference to the parent string. This is easy to do in a garbage collected language, because you don't have to do anything. But it's a lot more complicated if you need to do this with reference counting. Do you make every single string view update the reference counter? Do you make a special lighter string view that doesn't keep a counted reference, and is subject to memory safety issues?


Yep, you're right. One way to make this less of a problem is to make this distinction at the type level, having both an owned_string and a string_view for example. You can even make owned_string store its length inline.


These are regular questions in languages with (and without) reference counting, what’s so special about string views?


Typically you need 4 pointers to represent a strong reference count for a string view.

* One for the start of the source string, with an inline strong count * One for the end of the source string so you know how much to deallocate (only really applicable to Rust) * One for the start of the view * One for the end of the view

32 bytes for each string view is quite a lot. Depending on context you could use 32bit lengths instead of end-pointers if you're OK with <4GB strings, saving 8 bytes.


There's basically no distinction between a string view and an array slice. It's borrowing an array, and the view is nothing but a reference to the parent, start position, and length.

But views are also implemented as a plain pointer and a length, and that's where the memory safety issues from borrowing begin.


I understand the concern, but can’t you just maintain an actual reference field to parent_str in a string view? Unless I missed some no-extra-fields constraint itt, then sorry for the noise.


Let's say you took a document as a string, and split it up into words using a lot of string views. Every string view created would affect the reference count of the parent string. Then every time you work with the string views, saving temporary instances, passing them to a function, assigning them, whatever, you're affecting the parent string's reference count.

And reference counts are often atomic integer operations, so it might not be a regular memory increment, instead it would be an interlocked increment. And if there's multiple threads, the CPU cores will be competing over who gets to keep the reference counter in their L1 cache line. (There is a way around this where you can give threads an their own reference counter)


No voting machines were used. It was paper ballots with stamps.


Paper ballots, and a recount was already issued. There were differences between the two counts but they were minor enough; the recount was actually done because some other guy didn't like the fact that 2nd and 3rd place were only 2000 votes apart.

The breaches apparently didn't do much, the big reason why they cancelled the election was because the leading candidate declared 0 spending for his campaign, but it was proven he used russian money to fund countless tiktok videos that got him popular overnight. This is illegal under romanian law.

Personally, I don't think they should've been cancelled. It's a dubious thing to do under a democracy, and the runner-up was pretty decent anyway and had a chance for the second tour. I guess we'll see how it goes.


If people can only cast one vote, and you take the candidate with the most votes out of circulation (for whatever reason, campaign fraud in this case it seems), then you are discarding the votes of a large contingent of voters. Doing this and letting the results stand is wrong for the same reason why simply distributing the votes pro-rata among the other candidates is wrong: it is more likely that the candidate pulled votes from closely-aligned candidates than candidates on opposing ends of the political spectrum, so you get a skewed representation of the voting distribution.

Whichever method you choose to redistribute (or ignore) the votes cast for that one candidate doesn't matter: you will always end up in election-doctoring territory, even if you do everything by the book and in the open.

Other systems, like ranked-choice voting, might not need a do-over because relative preferences are already expressed on the ballot. But in this case, canceling the entire vote and re-doing it is the only sensible solution.


You have a point. It's a complicated issue for sure, I definitely don't want to be the one tasked with making a decision (and being judged for it!)


But the point of communication is mutual understanding. I generally agree that language is what we make it be, but in this case the wrong usage, meaning the usage that is mathematically incorrect, is causing issues.

I can't just go around saying that my cat is siamese even if he's not just because I got it wrong one time and now this is what siamese means to me. Because my goal is to transmit accurate messages.


There are relatively few people living south enough to have "cold and dark winters," anyway. The northern hemisphere is much more concentrated towards the north.

Most people live above 35°S where, at the most extreme, winter days are about 10 hours and a half long (plus about an hour of decent twilight). Temperatures obviously vary depending on region but they don't really get much below 10°C as far as I know.

So really, it's more like mostly bright and somewhat chilly.


Yep. The issue with megacorps (and more generally monopolies) is that they want to have their cake and eat it too. You want capitalism but you also want to be the only one on the market. Pick a side.


They do pick a side: success at capitalism implies outcompeting your peers. Without regulation, there will be winners, and they will tend to be monopolies. Marx pointed this out in his book “Capital” (Das Kapital) in the late 1800s.

Capitalism without regulation can’t reach a stable equilibrium.


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

Search: