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

The problem comes when there are lucrative odds for some unlikely scenario, which you can influence into realisation, and that outcome might be counter to the company's goals (i.e. sabotage)

Huh.


Is there a reason the Zig compiler can't perform type-narrowing for `u` within the `U::A(_) | U::B(_)` "guard", rendering just the set of 2 cases entirely necessary and sufficient (obviating the need for any of the solutions in the blog post)?

I'm not familiar with Zig, but also ready to find out I'm not as familiar with type systems as I thought.


it can narrow the payload: https://zigbin.io/7cb79d

I think the post would be more helpful if it had a concrete use case. let's say a contrived bytecode VM:

  dispatch: switch (instruction) {
      inline .load, .load0, .load1, .load2, .load3 => |_, tag| {
          const slot = switch (tag) {
              .load => self.read(u8),
              else => @intFromEnum(tag) - @intFromEnum(.load0),
          };
          self.push(self.locals[slot]);
          continue :dispatch self.read(Instruction);
      },
      // ...
  }
"because comptime", this is effectively the same runtime performance as the common:

  dispatch: switch (instruction) {
      .load => {
          self.push(self.locals[self.read(u8)]);
          continue :dispatch self.read(Instruction);
      },
      .load0 => {
          self.push(self.locals[0]);
          continue :dispatch self.read(Instruction);
      },
      .load1 => {
          self.push(self.locals[1]);
          continue :dispatch self.read(Instruction);
      },
      .load2 => {
          self.push(self.locals[2]);
          continue :dispatch self.read(Instruction);
      },
      .load3 => {
          self.push(self.locals[3]);
          continue :dispatch self.read(Instruction);
      },
      // ...
  }
and this is in a situation where this level of performance optimization is actually valuable to spend time on. it's nice that Zig lets you achieve it while reusing the logic.


It gets worse the further you go, this was where I had to bail:

> the format is much favored by AI frameworks such as TensorFlow and PyCharm.


Could mean "appear" as in "show up"


> one of the first times

I don't think you can say it's "neither"! :)


I don't think your "obvious" is the same as that of the person you're replying to.


I was hoping that that point comes through. There’s no font or symbol for sarcasm unfortunately except perhaps /s.

But in general war is about destruction and death. There is no scenario where one side gets away clean. There’s going to be training accidents, friendly fire, cook offs, equipment failure, and so on at a minimum.

People sometimes think that this stuff is like the movies where the heroes are perfectly good and walk away unscathed.

(Meanwhile the amount of casual property damage from even a single superhero fight ought to land both participants in jail at a minimum, even if they don’t accidentally kill some bystanders without even realising it.)


I think both sides of the war are horrible war criminals, but Israel has repeatedly both bombed civilians and lied about bombing civilian, so it’s Occam’s razor that they did it here too, and the burden of proof is on them to provide any evidence at all for misfire theory.


Only one side is launching rockets with a 25% failure rate.

All evidence is that Israel reliably hits their targets with precision.

People with an agenda — an axe to grind — are saying that clearly Israel specifically targeted the hospital. But missed. But it’s the intention that’s evil, because they must have wanted to hit it, and the fact that they missed it and it’s still standing is just more evidence of their failure as a nation. Hence they must be destroyed, or something.

PS: If you blindly accept the propaganda of one side over the other, then that side will abuse your blind faith mercilessly for selfish special interests. Interests that don’t actually align with yours. Don’t believe either side on faith. Use your brain.


Tough to gauge how impressive this is without a before/after for comparison tbh.


Fortunately the embedded video that the article sourced the claim from includes a side-by-side with FPS counters.


I guess at this point it kinda becomes about sustained thermals


I'd say that the people counting leap seconds are the ones "doing something".

At the point they needed to be inserted, Unix systems carry on counting seconds as units of time as they pass, "ignoring" the need to add 1 for the purposes of accounting.


> At the point they needed to be inserted, Unix systems carry on counting seconds as units of time as they pass

unix systems essentially will roll back clocks during leap seconds. here is handy dandy table as an example:

    Time                         tv_sec         tv_usec    
    2015-06-30T23:59:58.9Z       1435708798     900000
    2015-06-30T23:59:59.0Z       1435708799          0
    2015-06-30T23:59:59.1Z       1435708799     100000
    ...                          ...            ...          
    2015-06-30T23:59:59.9Z       1435708799     900000
    2015-06-30T23:59:60.0Z       1435708799          0
    2015-06-30T23:59:60.1Z       1435708799     100000
    ...                          ...            ...          
    2015-06-30T23:59:60.9Z       1435708799     900000
    2015-07-01T00:00:00.0Z       1435708800          0
    2015-07-01T00:00:00.1Z       1435708800     100000
    ...                          ...            ...          
I don't know about you but I wouldn't call that "counting seconds as units of time as they pass"


Hey, you're leaning into it too much!

Who are people who are against typing in this day and age?


> Who are people who are against typing in this day and age?

People who don't find the benefits of typing are worth the overhead?

Python is, after all, a dynamically-typed language, so it is, surely, not too surprising that those who use it might include those who want a ... dynamic language ?

If it's too much to take the joys of Java are freely available.


> are worth the overhead?

What overhead, specifically?

I've found it reduces overhead. Rather than using English to describe the types, in the comments/docstrings, I can just type the terse type hint in the function definition, and leave the rest to the documentation renderer. If you don't document anyways, sure.


I use python daily and dont use typing. The reason being that I choose python for it readability. And I find typed python to be less readable than non-typed python. If I wanted a typed language, I wouldnt want python.


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

Search: