Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
MrJohz
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
10 ms
·
121.
▲
by
MrJohz
11mo ago
Yeah, I believe that doesn't quite work correctly for nullable fields or cases where the Zod type would be a subtype of the declared type. But it's a really useful technique, because it's a lot easier to work with types you&#
122.
▲
by
MrJohz
11mo ago
Freedium is down, you may be able to read this using Medium instead: https://medium.com/@daxx5/why-zig-is-quietly-doing-what-rust... I could only see the first few paragraphs, but the writing is giving off a lot of &qu
123.
▲
by
MrJohz
11mo ago
I don't really agree with their argument, though. Pretty much all the features that Babel deals with are syntax sugar, in the sense that if they didn't exist, you could largely emulate them at runtime by writing a bit more code or
124.
▲
by
MrJohz
11mo ago
XML does not specify what a number is, I think you might be misinformed there. Some XML-related standards define representations for numbers on top what the basic XML spec defines, but that's true of JSON as well (e.g. JSON Schema).
125.
▲
by
MrJohz
11mo ago
Well yes, if you're writing a JSON parser in a language based on ECMAScript-262, then you will need to understand ECMAScript-262 as well as the specification for the language you're working with. The same would also apply if you
126.
▲
by
MrJohz
1y ago
Conveniently, all three of the major JS engines can be extracted from the browsers they are developed for, and used in other projects. Node and Bun famously use V8 and the WebKit one, and Servo I believe embeds SpiderMonkey. If you want to
127.
▲
by
MrJohz
1y ago
I think you are misreading the phrase "based on". The author, I believe, intends it to mean something like "descends from", "has its origins in", or "is similar to" and not that the ECMAScript 262 spe
128.
▲
by
MrJohz
1y ago
It's further than that even. JSX has the semantics of (modulo a couple of optimisations there and there) a bunch of nested function calls returning normal JavaScript objects. That means you can, in your head, very easily convert betwee
129.
▲
by
MrJohz
1y ago
Part of what Koka's functional-but-in-place system relies on is the Perceus program analysis, which, as I understand it, is kind of like a limited Rust-like lifetime analysis which can determine statically the lifetime of different obj
130.
▲
by
MrJohz
1y ago
I believe it's possible in theory - Koka has a whole "functional but in-place" set of compiler optimisations that essentially translate functional algorithms into imperative ones. But I think that's also possible in Koka
131.
▲
by
MrJohz
1y ago
Interestingly, I just read an article from matklad (who works a lot with Zig) talking about the benefits of splitting up error codes and error diagnostics, and the pattern of using a diagnostic sync to provide human-readable diagnostic info
132.
▲
by
MrJohz
1y ago
ESM is good, but if you've got more than a few dozen files in a project, you're going to start running into performance issues with complex waterfalls where the browser can't start running a file until it's downloaded al
133.
▲
by
MrJohz
1y ago
It's significantly slower than letting the browser do the work for you. Obviously performance isn't the only concern, but (a) as a user, I don't want people wasting my CPU cycles unnecessarily, and (b) I've worked on app
134.
▲
by
MrJohz
1y ago
> The direct semantics of JSX are "transform this syntax into this nested sequence of function calls and this layout of arguments". Not exclusively. SolidJS, for example, transforms the syntax into string templates with holes i
135.
▲
by
MrJohz
1y ago
With a bundler like Vite or TSX (not the same as the .tsx file extension), you really do just save the file, and everything reloads, usually instantaneously. That said, TS is now supported by default in NodeJS, Deno, and Bun, so if you'
136.
▲
by
MrJohz
1y ago
Hot-reloads in a modern bundler like Vite will typically be instantaneous. Normally in development, only dependencies are bundles, and the files you write are served as-is (potentially with a per-file compilation step for e.g. jsx or TypeSc
137.
▲
by
MrJohz
1y ago
There are plenty of ways around this. As others have pointed out, there are other options for styling XML that work well enough in practice. You can also do content negotiation on the server, so that a browser requesting an html document wi
138.
▲
by
MrJohz
1y ago
You probably don't want that most of the time, though. The time I'm most likely to send someone an article is once I've got to the end of it, but I don't want them to jump to the end of the article, I want them to start
139.
▲
by
MrJohz
1y ago
I'm quite unconvinced by this - it seems very easy to come up with all sorts of counterexamples, particularly in terms of public infrastructure, but also all of public services are regularly cut if the organising body doesn't see
140.
▲
by
MrJohz
1y ago
I would be very surprised if a website autofocused almost anything on page load, except for very specific applications where that makes sense. I just tried clicking through some forms on gov.uk, which is a website that has spent a _lot_ of
141.
▲
by
MrJohz
1y ago
You almost certainly don't want to assign tab order manually. Theoretically, if your html is out-of-order for some reason, then you can fix it with taborder, but there are so many issues with out-of-order html that it's much bette
142.
▲
by
MrJohz
1y ago
You always want all the accessibility features. If your button is a button, then you want the whole lot: the correct role, tabability, keyboards shortcuts, everything. There is no situation where you only want some of those features. So if
143.
▲
by
MrJohz
1y ago
Or more problematically, inject a bunch of ads that lead users on to scams. It would be ideal if people only browsed from trusted networks, but telling people "don't do the convenient, useful, obvious thing" only goes so far.
144.
▲
by
MrJohz
1y ago
I want to move a project I work in over from tsc to tsdown this week at some point, also with the unbundled mode. Currently we're using tsc with the new build mode to build everything at once, but the result is incredibly brittle and r
145.
▲
by
MrJohz
1y ago
There are other reasons as well. The body responsible for enforcing a particular law can choose not to enforce it, thereby rendering the law useless. Or a law can become obsolete by changes in technology or society - the original law legisl
146.
▲
by
MrJohz
1y ago
Yeah, I completely agree that the implementation hiding makes me very uncomfortable with this sort of approach. It's the same with a lot of Vercel's work - it's very easy to do simple things on the happy path, but the more yo
147.
▲
by
MrJohz
1y ago
That still requires the process running the outer generator to stay active the entire time. If that fails, you can't retry from step three. You need some way of starting the outer function part way through. You can do that manually by
148.
▲
by
MrJohz
1y ago
I don't believe you can. I believe what they're trying to do is rewrite the underlying function into separate functions that can be called in any order and combination. That's not possible with generators. With a generator, I
149.
▲
by
MrJohz
1y ago
The problem with higher-order functions is that you can't guarantee that your static analysis is correct, and you end up with functions that look like functions but don't behave like functions. It's similar to the problem tha
150.
▲
by
MrJohz
1y ago
But you can see there that it flags it as an error. The parser is lenient, sure, and tries to parse the rest of the file despite the error, but it's still not valid syntax, so you'd need to update all your other tools (LSP, format
More ›