Better HN
topnewbestaskshowjobs
Log inSign up

zero_shift

4,017 karma · joined Mar 10, 2017 (9y ago) · 930 submissions

I really like computers!
Submissions

comment 1y ago · link · parent

The video mentions being able to move from wxWidgets to Qt.

As someone who's never worked with either (only web UIs), I thought this would be a good chance to understand: why is wx bad, what makes Qt good?

comment 1y ago · link · parent

Continuing the masquerade will only make things worse

comment 1y ago · link · parent

I've also seen (non-GPU) programs use numbers with multiplication, instead of if-else, as a means of preventing CPU branch stalls. This technique is sometimes called branchless programming.

comment 1y ago · link · parent

Oh, that makes more sense, because ?: has eyes

https://en.m.wikipedia.org/wiki/Elvis_operator

?:-)

comment 1y ago · link · parent

I'm a big fan of the Elvis operator myself (.?)

comment 1y ago · link · parent

Floats are an excellent choice because they encode the inevitable ambiguity of the world. Instead of true and false we can have

    true    = 1
    false   = 0
    perhaps = 0.5

comment 1y ago · link · parent

Now that we have defined a language without booleans, we need some way to coalesce these optional values

We ideally want an infix function that can reduce the "truthiness" of two values.

Let us imagine this language is a Haskell-type-thing, and we can define pseudo-operators with pattern matching

    infixr 3 &&
    (&&) :: Optional -> Optional -> Optional
    Empty && _       = Empty
    _ && Empty       = Empty
    Some A && Some B = Some A
    _ && _           = Empty

    infixr 2 ||
    Some || _     = Some
    None || Some  = Some
    None || None  = None
    _    || _     = None 
Hmm, let's see how that looks

    a = b && c
    d = e || f
The good news is that we are free from the tyranny of booleans. The bad news is that we just reinvented JavaScript :-)

comment 1y ago · link · parent

> The list is based on analysis of student satisfaction with teaching quality and experience, entry standards, research quality, sustainability and graduate prospects

comment 1y ago · link · parent

We tried all that stuff in the early 2010s. I was there. It didn't work.

People ditched element-based CSS for good reasons: it forces you to maintain increasingly complex stylesheets, because you end up having to come up with increasingly arcane rules describing how the design links back to content.

But some design isn't about content. Sometimes you need a button that's centered because it just looks better. There's no semantics or document structure you can point to, to justify that.

(So then you end up with post-hoc mental gymnastics like, "hmm, well, it's the second last button on the page in this one instance, so let's write an :n-selector that only targets the penultimate <button>...")

So having classes lets you keep the look and the meaning orthogonal. Which is especially helpful when you don't have total control over the markup (e.g. most content management systems)

comment 1y ago · link · parent

It's also an effort being stymied by a handful of bad actors.

Case in point: one very prominent individual taking ownership of projects and inserting his libraries as dependencies. It then turns out he has a financial interest in increasing their download counts: https://github.com/A11yance/axobject-query/pull/354

comment 1y ago · link · parent

We tried this 20 years ago with "CSS zen" and the Bad Old Days of "semantic CSS". It failed because you cannot completely couple HTML structure and presentation.

Usually you have more complex styles and visuals than your HTML can express and trying to invent selectors / HTML heirarchies to describe them gets difficult very quickly

In addition you often need to support multiple style systems on a single web application whilst the design evolves, or else it becomes an all or nothing rollout when you change stuff.

It's common for engineers who weren't around back then to look at the abstractions that modern FE systems provide, and question if they're even necessary. That's healthy. What's not healthy is assuming they were only invented for fake or historical reasons, and telling everyone to just abandon them for commercial projects.

comment 1y ago · link · parent

Sorry, you are correct. I don't think unsigned overflow behaviour was defined until C99 though.

Anyway, in answer to the question, I would guess the reason was because of signed / unsigned type promotion.

comment 1y ago · link · parent

Some C programmers take the view that unsigneds have too many disadvantages: undefined behaviour for overflows, and weird type promotion rules. So, they try and avoid uints.

comment 1y ago · link · parent

Firstly, could you elaborate what code you're looking at? Square have never shared the source code for these titles and were not even practicing real version control at this time (see: Eidos FF7/8 debacle)

Secondly, it absolutely will run slower. Animations will take longer to complete; FMVs will play at a different rate ; controller sampling will be reduced.

My scepticism isn't coming from hearsay or ignorance: I have written PlayStation software, and PSX software is not parallelised, even though it can support threading and cooperative concurrency. The control flow of the title is very locked into the VSync loop, from your first ResetGraph(0) right to your final DrawOTable(*p).

In addition, I have done a bunch of reversing work on the other two PSX games, and they are not monolithic programs. They can't be because there simply isn't enough RAM to store the .TEXT of the entire thing at once. So when you say "the source code", I'm inclined to ask - for which module? The kernel or one of the overlays?

comment 1y ago · link · parent

What code are you looking at?

FFIX for PSX would have been written in C (or possibly C++) with PSY-Q. It will not be one program - those games were composed of multiple overlays that are banked in / out over the PlayStation's limited memory.

From what I know the PC release was a port to a new framework, which supports the same script engines, but otherwise is fresh code. This is how it can support mobile, widescreen, Steam achievements etc.

comment 1y ago · link · parent

When you say looking at the source code, what do you mean here?

AFAIK the source for FF9 PSX (and all the PSX ff games) has been lost as Square just used short term archives

Also, FF9 does not run at a constant framerate. Like all the PSX FF games it runs at various rates, sometimes multiple at a time (example: model animations are 15fps vs 30 for the UI)

In terms of timers, the bios does grant you access to root timers, but these are largely modulated by a hardware oscillator

(Incidentally, the hardware timing component is the reason a chipped PAL console cannot produce good NTSC video. Only a Yaroze can support full multiregion play)

comment 1y ago · link · parent

Oh yeah. The sword you pick up in Memoria. The problem there is that the PAL version runs slower; the way PSX games "translated" between the two video systems was just to have longer VSync pauses for PAL. So the game is actually slower, not interpolated

comment 1y ago · link · parent

About a year ago I was looking at Crash Bandicoot timer systems and I found that Crash 3 has a constantly incrementing int32. It only resets if you die.

Left for 2.26 years, it will overflow.

When it does finally overflow, we get "minus" time and the game breaks in funny ways. I did a video about it: https://youtu.be/f7ZzoyVLu58

comment 1y ago · link · parent

> The way you know it's magic is it shatters the principle of referential identity, which tells you that a variable is itself

When you do a useValue() it is clear you are grasping at something with a larger lifespan than your function.

Conceptually it is not much different than

    int counter() {
      static int x = 1;
      return x++;
    }
Which predates C89, if age is an argument

comment 1y ago · link · parent

> Thats what makes it a new language. C is just sugar on top of assembly.

I think that's a bad example. C isn't a sugar for assembly: For example what assembly code does a function prototype desugar into? Sugars have 1:1 mappings with host code

Maybe you're just being rhetorical about the spectrum of macros, sugars, and languages, though.

(In my opinion, a better target for that criticism, in JS land, is the Jest test framework, because of all the reordering magic it does that break fundamental ES semantics)

> Why className instead of class?

This hasn't been a constraint since... I want to say React 18, six or seven years ago? I might be misremembering the history but I think that was only a problem in the Early Days when there was paranoia about whether JSX needed to be conservative with reserved keywords

comment 1y ago · link · parent

> So JSX is pure Javascript and not, say, a dialect of XML embedded in JS?

It would be best to think of it as syntax sugar for create Element() function calls. You enter JSX with angle tags and insert expressions in braces

> React is full of magic syntax that looks like functions, but e.g. you can't call them inside an if statement, or you have to redundantly declare the 'dependencies' (variables you read) and so on

That's not magic syntax. That's just functions that must be processed in regular order between render ticks.

It's not a difficult exercise to write a "plain JS" function that works that way. If you've worked much with closures you can visualise how that would play out.

comment 1y ago · link · parent

I always saw "design patterns" as a symptom of the OOP culture. The mid 2000s was the worst era for this. Everything had to be packaged as nouns and programmers saw their "profession" as being about defining taxonomies of design patterns and ideally encoding them in abstract classes.

This is what leads to almost satirical situations where a "command evaluator abstract class" is a way to express "a function"

comment 1y ago · link · parent

A small tip for Go folk: the Goreleaser tool makes it very easy to manage your formulae, at least for distributing binaries (allowed in personal taps but a no-no in core)

comment 1y ago · link · parent

Isn't your argument a support of his claim?

If emotions did not weigh on recall, surely there would be no "emotion-driven cognitive biases"

1
8910
31