674 karma · joined Apr 15, 2015 (11y ago) · 140 submissions
comment 2y ago · link · parent
But runtime checks have a cost, and static types that transpile away are a bit better for overhead so long as you don't mind the build step, so using one of the typed lua variants is probably a bit nicer in the long term. Catching those typos early is their bread and butter.
comment 2y ago · link · parent
comment 2y ago · link · parent
Serverless functions, right? That's what deno deploy is billed as. Presumably the registry is a platform-adjacent investment to try and bring more serverless market-share to deno. Since it provides a npm-registry compatible facade, presumably you should feel safe publishing deno-y code to it (without calling platform APIs?), and should thus be more likely to use deno, and thus enter the funnel for deno deploy.
Personally, I just use deno's rust v8 wrappers a bunch, since they make embedding a V8 runtime into a rust app very simple, and js is a very nice scripting engine (especially with optional types). A hugely valuable contribution to the open source community. But then again, I don't deploy serverless functions on the regular. To each their own.
comment 2y ago · link · parent
I don't think it has any relation to runtime type checking at all. It's refinement types, [4] or newtypes[5] depending on the details and how you shape it.
[1] https://github.com/microsoft/TypeScript/blob/main/src/compil... [2] https://github.com/microsoft/TypeScript/issues/4895 [3] https://github.com/microsoft/TypeScript/pull/33038 [4] https://en.wikipedia.org/wiki/Refinement_type [5] https://wiki.haskell.org/Newtype
5.
Proposal: Types as Configuration(github.com ↗)
2 points · by wwwigham · 2y ago · discuss
comment 3y ago · link · parent
This point stings for me, personally, since _I_ was the TypeScript language dev _in_ this wg trying to make our concerns noted, because we certainly did participate. However the group largely deadlocked on shipping with ecosystem compatibility measures, and what you see in node today is the "minimal core" the group could "agree" on (or be bullied into by group politic - this was getting shipped weather we liked it or not, as the last holdouts). The group was dissolved shortly after shipping it, making said "minimal core" the whole thing (which was the stated goal of some engineers who have since ascended to node maintainer status and are now the primary module system maintainers), with the concerns about existing ecosystem interoperability brought up left almost completely unaddressed. It's been a massive "I told yo so" moment (since a concern with shipping the "minimal core" was that they would never be addressed), but it's not like that helps anyone.
Like this shipped, because _in theory_, it'd be a non-breaking from a library author perspective to get node's CJS to behave reasonably with ESM (...like it does in `bun`, or any one of the bundler-like environments available like `tsx` or `webpack` or `esbuild`), and _in theory_ they're open to a PR for a fix... I wish anyone who tries good luck in getting such a change merged.
comment 3y ago · link · parent
ESM may very well be the module system designed for a world that'll actually never exist, and will mostly just be an ill defined compilation target. But hey, maybe the next web module system will do better - those wasm working group people are working hard on their module system - and it's intended as a compilation target from the start, so shortcomings in it can be patched over by tools from the start :)
comment 3y ago · link · parent
I can't think of a concrete benefit to a developer that ESM brings (just pain, but maybe I'm biased by what I'm exposed to). Probably why it's so slow to be adopted.
comment 3y ago · link · parent
comment 3y ago · link · parent
comment 3y ago · link · parent
To be real, I don't think they'd get any perf gains from a wasm component - not until most of the library is wasm, anyway. The dream of offloading a small hot function to a faster, instruction-optimized wasm implementation is usually killed by marshalling costs for anything other than numbers. Even the perf of simple string functions (like `normalizePath`) often get destroyed in practice by things like unicode validation, since the string models and memory layouts between JS and Rust don't match. Still, despite all that, it's tempting to _try_ because, well, what else are you going to look into for performance gains? Once you've tracked down all your v8 deopts and monomorphized all your hot code, what's left but telling v8 to get out of the way as much as possible, while you go as low level as you can? Algorithms improvements? Those often amount to random flashes of insight - you can't plan those. So when a lot of people say "Hey, I reimplemented 5% of X in Rust and it's 20x faster!" you _could_ smugly assume it's because it's a partial implementation, or you can choose to believe that the authors don't have ulterior motives and the tech stack itself has merit and investigate it yourself. It'll be easier and more fun than thinking hard about usage patterns and algorithms all day, anyway.
comment 4y ago · link · parent
[1]https://github.com/microsoft/TypeScript-wiki/blob/main/Perfo...
comment 4y ago · link · parent
The specifics of the proposal will likely shift a bit since it's still stage 1 (2?).
comment 4y ago · link · parent
Case is a small form factor case: https://hdplex.com/hdplex-h1-v3-fanless-computer-case.html
You actually paste heat pipes from the CPU to the case itself, using the large fins on the case as a massive heat sink.
Inside I have an Intel Core i7 10700 and 2 Samsung 970 Evo Plus 2TB SSDs. Works fantastically as a media server, under near constant hardware transcoding load.
comment 4y ago · link · parent
[1]https://www.typescriptlang.org/tsconfig#noErrorTruncation
comment 4y ago · link · parent
Anyways, many public-facing compilers (C++, C#, VB, F#, the .NET runtime as a whole, TypeScript) are in the devdiv org - if you look up Julia Liuson in the org chart and explore down from there, you can probably get a good idea of who you most want to grab coffee with (or whatever the remote work equivalent of that is now).
Outside of devdiv, there's also some esoteric c++ compilers, PowerShell, and SQL compilers housed in the windows and azure orgs, plus iirc there are some people who work on v8 fulltime around the edge team now, too.
Point is that you've got much more direct access to those teams and opportunities than most people already, being only an internal transfer away - hopefully you can make use of that.
comment 4y ago · link · parent
You use an ambient declaration to declare the missing classish part of the type.
declare function myLibrary(arg: Type): myLibrary;
declare class myLibrary {
member: Type;
constructor(arg: Type);
}
You see this pattern pretty often in DefinitelyTyped.comment 4y ago · link · parent
[1] https://raw.githubusercontent.com/microsoft/TypeScript/main/... [2] https://unpkg.com/typescript@4.7.4/lib/tsc.js
comment 4y ago · link · parent
In action: https://www.youtube.com/watch?v=sOBhAbXNgUI
IIRC, he actually used it on coop for awhile with a physical ticket spike to store completed tickets on. It's pretty cool to see when the issue volume is just right.
comment 4y ago · link · parent
Node's working on it.
comment 4y ago · link · parent
comment 4y ago · link · parent
One of the first lines in the deno docs is:
> Deno has no "magical" module resolution.
Which, as an implementor of module system rules, seems incredibly far from the truth of the matter (where deno has the most complex resolution rules of any runtime currently in use). I think maybe there were simple goals at the start, but that came crashing against reality and xkcd 927 executed in full force.
comment 5y ago · link · parent
Fun fact: If you add a private field to a class it'll behave nominally in TS. This is because private fields kinda require nominal relations to function. So, in a way, it does support "switching" to nominal type checking for classes - the opt in is simply per-class.
comment 5y ago · link · parent
comment 5y ago · link · parent
I think the real "WTF" here is that the go compiler quietly makes a simple `nil` written in your code into one of potentially many nil-like sentinels at runtime (contrary to what one may think), coerced depending on usage, and, moreover, that a simple `==` comparison or reflective call alone is insufficient to detect all of them. The semantics of how such a sentinel is coerced (and reflected) is surely in the realm of language esoterica and not simple beginner knowledge.
comment 5y ago · link · parent
comment 5y ago · link · parent
This right here is "here be dragons" commenting level Double Dragon.
When I come back to code I've written long in the future, I think I'll be happier to have written the detailed "commenting level Double Dragon" long comments, over the more ambiguous yet still traditional `// HERE BE DRAGONS`. Mostly because that comment will give me the context I need to know if any of that _why_ has changed and thus in what way it's likely safe to change the commented code.