HNHacker News
TopNewBestAskShowJobs

Karellen

5,317 karma · joined October 27, 2011

submissionscomments
Karellen··on Array.shift Optimizations in Firefox's JavaScript Engine (2020)
> I was surprised to learn that even implementing isEmpty(ob) in Javascript is an O(n) operation on most runtimes.

That is surprising. Where `n` is the number of members, yes?

Surely that kind of operation should either return false immediately if there are no members, or return true in constant time if there is at least one member?

...although, do you have to iterate through the inherited members and check for `hasOwnProperty()`? Is it maybe O(n) where `n` is the number of enumerable inherited properties?

Karellen··on Array.shift Optimizations in Firefox's JavaScript Engine (2020)
> the index 2 remains present as a “hole” (like I mentioned before, almost a third kind of null).

It's an interesting model, and I think it definitely has its uses when reasoning about JS arrays. I'm not yet convinced it's the best model, but it's something I'm going to have to let percolate through my brain for a while to weigh it up properly. Thanks.

Karellen··on Array.shift Optimizations in Firefox's JavaScript Engine (2020)
> It doesn’t actually delete the presence of the index.

Doesn't it? Try:

    a = [ 6, 7, 8, 9, 10 ]
    delete a[2]
    for (x in a) { console.log(x) }
Karellen··on Array.shift Optimizations in Firefox's JavaScript Engine (2020)
Isn't this kind of negated by the fact that `delete arr[n]` working the way it does has required JavaScript arrays to never have been "real" arrays, in the entire history of the language?
Karellen··on Ask HN: How do you switch between multiple programming languages while coding?
Yes, it happens to me too.

If you want to get better at switching, practice more in both languages, separately.

Most of all, don't worry about making simple mistakes. If there's one thing that compilers, linters, test suites, and judiciously placed printf()/console.log() statements have taught me, is that I'm terrible at getting code exactly right the very first time. But that's OK, because if I've got the "shape" of the code mostly right (which I'm somewhat better at) then a couple of iterations on syntax, the order of expressions, and the fine details of those expressions, take very little time. Whether those fixups are needed due to language switching, or just general human error-propensity.

Is your checked-in code quality, and your end-of-the-day productivity, on a par with that of the work colleagues you respect? If so, how you get there is working for you.

If you want to get better at your craft, that's good. And spotting specific areas you'd like to improve at is helpful for that. But that doesn't mean you should beat yourself up for not being there yet.

Karellen··on I don't want to fill out your contact form
A coach that you paid money to advised you to lie during a behavioural interview?

Well, that could certainly give the prospective employers plenty of information about the way you behave.

I wonder how many lies the coach told you about themselves and their qualifications, on the belief that you'd never check on their story.

Karellen··on The user is on their own
I have used a power drill more than once before, but it doesn't have "the number setting" like the one in the picture does. (Instead it has a single toggle labelled "900" and "2400" - as well as the on/off trigger)

To me, it's not even intuitive if I'm supposed to try and answer the question or not.

Karellen··on The user is on their own
> The only "intuitive" interface is the nipple. After that it's all learned.

-- Bruce Ediger (probably)

Karellen··on Astronauts could run round 'Wall of Death' to keep fit on moon, say scientists
> on Earth I imagine this isn't possible

Only if you use a vertical wall as the "floor".

If you set the "floor" at, say, 45deg, and then spin the centrifuge up enough so that the floor feels level, you could practice running at √2g (~1.4g). Then vary the floor angle and centrifuge speed for various g levels while running on what feels like a level surface.

Karellen··on The European Union's remarkable growth performance relative to the United States
> Why is this a problem as long as those at the bottom experience the maximum amount of growth possible?

What makes you think they are?

Karellen··on The European Union's remarkable growth performance relative to the United States
Because the UK doesn't have any dodgy crown-dependency money-laundering tax havens?
Karellen··on The European Union's remarkable growth performance relative to the United States
But under "the natural consequence of evenly distributed economic growth" Steve was and is making a constant 66% share of the wealth.

Except that's not we have in the US/EU/UK. The top earners have been increasing their share since the 1970s, if not longer. See, e.g.

https://www.bbc.co.uk/news/business-59565690

> since 1995, billionaires' wealth had risen from 1% to 3%.

> The world's richest 1% has taken more than a third of all additional wealth accumulated since 1995, while the bottom 50% captured just 2%.

> The researchers found that the world's 52 richest individuals saw the value of their wealth grow by 9.2% per year for the past 25 years, well above less wealthy social groups.

(That was just one of the page 1 results for "wealth inequality history" that I got. I know I've read better analyses that cover longer time periods before, but I'm feeling lazy at the moment. If you have any links at all to suggest we're in anything like "evenly distributed economic growth" then there's a possibility I'd be inclined to dive deeper.)

Karellen··on Run0, a systemd based alternative to sudo, announced
> I for one love to type out 13 extra characters

FWIW, systemd is normally pretty good at providing autocomplete suggestions, so even if you don't want to set up an alias you'll probably just have to type `--b<TAB> ` to set it.

> I wonder what random ASCII escape sequences we can send.

According to the man page source[0]:

> The color specified should be an ANSI X3.64 SGR background color, i.e. strings such as `40`, `41`, …, `47`, `48;2;…`, `48;5;…`

and a link to the relevant Wikipedia page[1]. Given systemd's generally decent track record wrt defects and security issues, and the simplicity of valid colour values, I expect there's a fairly robust parameter verifier in there.

In fact, given the focus on starting the elevated command in a highly controlled environment, I'd expect the colour codes to be output to the originating terminal, not forwarded to the secure pty. That way, the only thing malformed escapes can affect is your own process, which you already have full control over anyway.

(Happy to be shown if that's a mistaken expectation though.)

[0] https://github.com/systemd/systemd/blob/main/man/run0.xml

[1] https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_G...

Karellen··on Run0, a systemd based alternative to sudo, announced
> I also wasn't a fan of the tinting.

From the linked mastodon thread:

> For example, by default it will tint your terminal background in a reddish tone while you are operating with elevated privileges. That is supposed to act as a friendly reminder that you haven't given up the privileges yet, and marks the output of all commands that ran with privileges appropriately. (If you don't like this, you can easily turn it off via the --background= switch).

(emphasis mine)

Karellen··on A few facts about POSIX
> > > such as MacOS, that are fully compliant with the POSIX standard

> > Until you have to gets your hands dirty and find small and bigger faults everywhere. For example, /bin/sh [...] doesn't work properly in these two parameter expansion cases:

> It’s irrelevant. Neither POSIX nor the UNIX certification [...] requires a recent GNU userland

Is it irrelevant?

If an implementation passes the conformance test suite, but is buggy according to the text of the spec in a way that is not caught by the test suite, can one really say it's "fully compliant with the POSIX standard"?

Is it the test suite that's the final arbiter of the POSIX standard, or is the text of the spec? Because I thought that the point of having a written spec, ratified by a standards body, is that the text of the spec defines what the spec is. It is the text of the spec that is submitted to the standards body, after all, not the test suite.

Karellen··on A few facts about POSIX
Program^WCompliance testing can be a very effective way to show the presence of bugs, but it is hopelessly inadequate for showing their absence.

-- Edsger Dijkstra (ish)

Karellen··on A few facts about POSIX
> However, there are a number of operating systems, such as MacOS, that are fully compliant with the POSIX standard and can therefore be called Unix operating systems, not just Unix-like.

It's a bit more nuanced than this. Being fully compliant with the POSIX standard isn't quite enough; you have to pass an official conformance test suite and be certified by the Open Group to have passed it, in order to call yourself "Unix", rather than just being Unix-like.

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

So there could be (and likely are) implementations out there which are fully compliant with the standard, but have not chosen to get certified, and are therefore technically still "not Unix".

Karellen··on You can't just assume UTF-8
If the Unicode consortium haven't been able to come up with a way of encoding their name correctly, I don't see what hope I have of doing so.

Bonus - as soon as the Unicode consortium do find a way, my software should be able to handle it with no further changes. Well, it might need a recompile against a newer `libicu` as I don't think they maintain ABI backcompat between versions. But there's not much I can do about that.

Karellen··on You can't just assume UTF-8
Don't worry, I never assume UTF-8.

I require UTF-8. If it isn't currently UTF-8, it's someone else's problem to transform it to UTF-8 first. If they haven't, and I get non-UTF-8 input, I'm fine bailing on that with a "malformed input - please correct" error.

Karellen··on Husband and wife outed as GRU spies aiding bombings and poisonings across Europe
Did you check out the original UK House of Cards? Worth catching if you can find it.
Karellen··on What's Going on with ‘Nonplussed’? (2017)
Wow. You really want some arbiter of which words are "allowed" or not? That sounds like some real Ministry of Truth type shit. It seems especially weird on a tech site, when tech jargon has historically been rich with wordplay and word construction.

http://www.catb.org/jargon/html/introduction.html

http://www.catb.org/jargon/html/writing-style.html

Karellen··on What's Going on with ‘Nonplussed’? (2017)
> "Inflammable" is my go-to example of a word that shouldn't exist in the English language.

What about "inflammation" (from the same root), like what happens when you bruise yourself, or injure a joint? Is that OK?

Or you should you get a "flammation" instead?

Edit: Or when interpersonal tensions are high, and a situation becomes inflamed?

Karellen··on What's Going on with ‘Nonplussed’? (2017)
The fact that this 1930-era additional meaning is being described as "new" makes me think that there might also be another meaning of "new" that I wasn't previously aware of!
Karellen··on What can LLMs never do?
> The scenario you described is possible if you started at the South Pole. If you travel 24,901 miles east from there, you would indeed end up back at the same spot

Would you? How can you travel east at all, starting from the South Pole? There is no east. Every direction you face is north.

OTOH, every line of latitude whose length is an integral divisor of 24,901 miles will satisfy the problem.

Karellen··on Leaving Rust gamedev after 3 years
> Personally I think operating systems (kernels) should be as performant as possible, and C/C++ has been good enough for decades.

If that how you want your OS, that's fair enough. But I think a lot of people are happy to trade (to some degree, at least) performance for security, and would prefer that their OSs are as secure as possible first, and as performant as they can be second.

Karellen··on GM collects driver behavior data then sells access to insurance companies
I don't understand how those will make a difference if a friend gives you a lift somewhere and back again? Or if your partner is driving?
Karellen··on No Abstractions: our API design principle
Compare GTK/Qt to raw xlib/wayland/win32/cocoa primitives - including the way that those toolkits abstract away the differences.

Or (as others have pointed out) the various `git` "porcelain" commands (checkout/add/commit/branch) compared to the primitive operations for dealing with various object types. Even just `git pull` as a combination of `git fetch` and `git merge`.

Or how a filesystem API of open/read/write/close/unlink is a very simple abstraction over block allocation and (in the old days) moving a disk head and waiting for the platter to spin under it in order to access the right sector. Not to mention the "directory" and "subdirectory" abstraction, instead of just having one giant table of inode numbers.

Edit: Or compare HTML with abstractions like "headings" and "paragraphs" to a raw typesetting language like troff or TeX.

Karellen··on GM collects driver behavior data then sells access to insurance companies
How will they know which car you're in for any given journey?
Karellen··on Open Sourcing DOS 4
Why is that, no matter how much you check and proofread your work before you push/publish, you'll always find something obvious you missed 5 minutes after it's gone up?

To change a public branch, or not to change a public branch, that is the question.

Edit: Muphry's law strikes again - s/or to not/or not to/

Karellen··on Open Sourcing DOS 4
Wait, why is `git pull` for an OS that ran on computers with memory and floppy-disk sizes measured in 100s of KiB taking more than a couple of seconds to download?

...Oh, there's 100MiB of PDFs in there, which are high-resolution scans of the paper technical documentation. Fair enough.

← PreviousPage 5 of 34Next →