4,017 karma · joined Mar 10, 2017 (9y ago) · 930 submissions
comment 1y ago · link · parent
https://en.m.wikipedia.org/wiki/Elvis_operator
?:-)
comment 1y ago · link · parent
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
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
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
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
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
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
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
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
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 argumentcomment 1y ago · link · parent
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
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
This is what leads to almost satirical situations where a "command evaluator abstract class" is a way to express "a function"