HN user

chronial

593 karma
Posts2
Comments273
View on HN

Draw a square around Einstein's face. Call the side length of the square a and the area of the square A. We have A=a^2. Einstein takes up some portion p < 1 of that area, so Einstein has area E = pA. Now we scale the whole thing by factor f. So the new square has side lengths fa, and thus area A' = (fa)^2 = f^2×a^2 = f^2×A. Since the relative portion the face takes up doesn't change with scaling, the face now has size pA' = p×f^2×A = f^2 × pA = f^2 E.

Does that help or was that not the part you were missing?

Which old times are you referring to / what are "sensible" names?

I thought about it and I don't know what a better name would be. Off the top of my Head, I know Perforce, BitWarden, Subversion, fossil and git. And then the abbreviations CVS, RCS and SVN.

Do any of these qualify as a descriptive name?

One repo uses `master` but a subtree uses `main`. If you make a mistake and checkout `main` you end up clobbering your whole working tree with the subtree.

If you replace checkout with switch/restore, that foot gun goes away.

A very effective solution for that is a well-configured shell. IF you summarize the state of the repo in the prompt, it is always visible while typing a command.

That's the reason why it was replaced by two separate, more sensible commands: git switch for switching branches etc, which is safe, and the inherently dangerous git restore for reverting changes in your working directory.

Funny, I did just exactly that at work yesterday. If your branches have linear histories, here's what to do:

1. Make sure all branches touch separate files. I would strongly recommend git-filter-repo over git-filter-branch. It's way simpler to use and orders of magnitudes faster.

2. Generate the list of commits in the correct order:

git rev-list --date-order --reverse branchA BranchB BranchC > revisions.txt

3. Go to any branch and: git rebase -i --root --force-rebase

Paste the contents of revisions.txt into the sequence editor and add "p " at the bigging of every line. Run the rebase and you are done.

Why would I care about the other cases?

Because you talk about the other cases when you make general statements like:

it's that FireFox just isn't as fast as Edge.

I can't change my code,

I wasn't suggesting you change anything about your code. Remember, the context of this conversation is this Statement by GP:

I hate that I know exactly why. It's because they were only ever tested on Chrome during development.

The reality is that Firefox has a tiny market share at this point, so it is questionable how much time should be invested into optimizing pages to make them fast on Firefox. But that is a problem with Firefox's market position, not technology.

My point was that when code is slow in Chrome, you change it and never notice whether Firefox would have been faster in those cases. You only test code that is sufficiently fast in Chrome in Firefox. Thus, you don't usually see the cases where Firefox is faster than Chrome.

It's not that I haven't tested, it's that FireFox just isn't as fast as Edge.

Only in this one specific case. You don't know the other cases. What you do is write code and check if it's fast enough in Chrome. If it's not you change your code. You never check if it's fast in Firefox instead and then go on with your day, saying "well chrome's just slow".

I feel like some of the nuance got lost in at least two places:

"trying to do the wrong thing with ChatGPT" vs "using ChatGPT in the wrong way" "have been "approved" by this AI" vs "have been reviewed and approved by this AI."

I prefer the original phrasing.

Besides Rust everything else is a toy without stability and backwards compatibility and/or lack of libraries. Rust is fine, it’s just that the problems it tries to solve aren’t something that experienced C++ devs often struggle with.

The single main reason for Rust's success is that this statement was proven wrong again, again and again. C/C++ devs kept repeating it, severe bugs keep getting discovered.

How would you use this with a C/C++ codebase, where you build your dependencies yourself and don't get them from a package manager? All vulnerability databases seem to refer to package repos. Is there anything that works with only library name + version?

Why would I be paying for bathroom breaks and idle time?

You want your workers to compile the code before committing it and moving on to the next task, right? But don't feel like you should pay for that?

Or are you assuming that people are like fleshy machines that can just store the data they just used on disk and work on something else while the compilation is running and then they just put that data back into RAM once the compilation is done? People don't actually multitask that well.

[...] some of this idle time is spent thinking about problems to solve related to the job, but it's something that can be done in your free time, or while commuting.

Now that just sounds like you don't feel like you should pay workers that do intellectual work for their work at all – they can do their work in their "free" time? By that logic I don't see why you don't just pay for the 1 minute it takes to commit the code once it's finished – in the end that's all you care about. Why would it be your problem how they get there?

Yes, I did not go into details where the differences are coming from. The base clockspeeds are the same, which is obviously the number that GP noticed not changing over the last 10 years.

Other things changed. The turbo clockspeed is one of them.

I can only quote OP on this:

But if you feel the need to transform simple linear code into a map of higher order functions because of some abstract benefits you're probably doing stuff that's too easy for you and you should get your mental challenge from solving a more difficult problem instead.

This code is only complicated because you insist on following some abstract ideal. The actual way to solve this in python is:

  total_foos = sum(elem.foo for elem in elems)
  pruned = [e for e in elems if e.foo < len(elems)]
Which is shorten than even your first code sample. If you directly translate your last example into sensible python, you get a nice example of some "simple linear code":
  total_foos = 0
  pruned = []
  for elem in elems:
      total_foos += elem.foo
      if elem.foo < len(elems):
          pruned.append(elem)
The existence of statements in python clearly stands in the way of achieving ideals of pure functional programming. But I think aiming for such ideals is the exact opposite of the point OP was making.

pulling those out may lose access to required lexically-scoped variables

The only situation for this that I can think of is inside a list comprehension / generator expression. You are aware that you can define functions at any scope in python?

that's not what the GP was asking for in this case.

You really think that when they mentioned the dynamically allocated `Vec` in Rust (which has fixed-sized arrays) and "manual memory management" in C, what they were actually talking about was a static array?