frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

Open in hackernews

Comptime.ts: compile-time expressions for TypeScript

https://comptime.js.org/
104•excalo•3d ago

Comments

Thom2000•7h ago
Interesting. I've never seen the import-with syntax, though and it's hard to find any documentation on it. Is this a syntax extension?
nrabulinski•7h ago
It’s been introduced as part of ecmascript 2026 https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
no_wizard•6h ago
It first started as an assert statement[0] for those who may have seen that, these type statements are an evolution out of that proposal.

I do wonder if this makes the importable gets (via type: json) a reality like assert was going to.

[0]: https://v8.dev/features/import-assertions

throwitaway1123•5h ago
> I do wonder if this makes the importable gets (via type: json) a reality like assert was going to.

Yes, the JSON modules proposal is finished.

https://github.com/tc39/proposal-json-modules

https://caniuse.com/mdn-javascript_statements_import_import_...

no_wizard•4h ago
An entire class fetch requests will go away with importable gets. I am excited for this
mdarens•5h ago
One of the most exciting features of Zig, but am I correct that this doesn’t apply to types themselves like comptime generics in Zig? I find that to be one of the most powerful ideas: type level mappings that have the same syntax as the runtime code where you can just set an iteration limit. This would be a great way to get around the “too large union” problem in TS, for example.
apatheticonion•5h ago
I literally just want Rust style macros and proc macros in JavaScript. e.g. using

``` const MyComponent = () => jsx!(<div></div>) ```

rather than a .tsx file.

That or wasm to be usable so I can just write my web apps in Rust

teaearlgraycold•4h ago
You want manual memory management for your web apps?
tekacs•3h ago
Rust memory management is... profoundly not manual?

Case in point: I use Rust/WASM in all of my web apps to great effect, and memory is never a consideration. In Rust you pretty much never think about freeing or memory.

On top of that, when objects are moved across to be owned by JS, FinalizationRegistry is able to clean up them up pretty much perfectly, so they're GC-ed as normal.

alpinisme•2h ago
That particular example is odd. What are you gaining by having a macro that needs a compile step vs no macro and just configuring your compile step to use a JSX loader for js files?
krukah•36m ago
Maybe the (relative) lack of ecosystem has kept you away, but I really recommend checking out both Dioxus and Leptos. Leptos is incredibly similar to React, but with Rust ergonomics, and it's been a pleasure to learn and use. With an LLM by my side that knows React and Rust pretty well, I've found myself not even needing the React libraries that I thought I would, since I can easily build on the fly the features/components I actually need.

I too, eventually gave up on React <> WASM <> Rust but I was able to port all my existing React over into Leptos in a few hours.

JoelMcCracken•23m ago
Every once in a while I get a strong urge to hack on sweet.js to add typescript support
sriku•12m ago
The bun and other authors would probably do well to not repurpose already understood terminology. "Macros" are already understood to be code that produces other code. "Comptime" is a nice alternative, but bun's "macros" aren't macros in that sense.

We had sweet-js macros as a library many years ago but it looks like it went nowhere, especially after an incompatible rewrite that (afaik) remains broken for even basic cases. (Caveat: been a while since I looked at it)

stevage•5h ago
I could imagine this being useful for pre-compiling markdown.
spankalee•3h ago

    import {sum} from './sum.js' with {type: 'comptime'};
is an unfortunate abuse of the `type` import attribute. `type` is the one spec-defined attribute and it's supposed to correspond to the mime-type of the imported module, thus the two web platform supported types are "json" and "css". The mime-type of the imported file in this case is still `application/javascript`, so if this module had a type it would be "js".

It would have been better to choose a different import attribute altogether.

alpinisme•2h ago
You’re projecting the mimetype idea from two examples but the proposal is intentionally agnostic about what type might be used for:

> This proposal does not specify behavior for any particular attribute key or value. The JSON modules proposal will specify that type: "json" must be interpreted as a JSON module, and will specify common semantics for doing so. It is expected the type attribute will be leveraged to support additional module types in future TC39 proposals as well as by hosts.

shortrounddev2•2h ago
Would be really great if it could return named functions

Mac history echoes in current Mac operating systems

http://tenfourfox.blogspot.com/2025/08/mac-history-echoes-in-mac-operating.html
39•classichasclass•1h ago•6 comments

Claude Code IDE integration for Emacs

https://github.com/manzaltu/claude-code-ide.el
588•kgwgk•14h ago•192 comments

Rules by Which a Great Empire May Be Reduced to a Small One (1773)

https://founders.archives.gov/documents/Franklin/01-20-02-0213
76•freediver•4h ago•25 comments

A Candidate Giant Planet Imaged in the Habitable Zone of α Cen A

https://arxiv.org/abs/2508.03814
26•pinewurst•2h ago•9 comments

Project Hyperion: Interstellar ship design competition

https://www.projecthyperion.org
162•codeulike•7h ago•135 comments

Litestar is worth a look

https://www.b-list.org/weblog/2025/aug/06/litestar/
198•todsacerdoti•8h ago•50 comments

We'd be better off with 9-bit bytes

https://pavpanchekha.com/blog/9bit.html
102•luu•8h ago•192 comments

Jules, our asynchronous coding agent

https://blog.google/technology/google-labs/jules-now-available/
241•meetpateltech•11h ago•164 comments

The Day MOOCs Died: Coursera's Preview Mode Kills Free Learning

https://www.classcentral.com/report/coursera-preview-mode-paywall/
33•deepakkarki•3d ago•19 comments

Show HN: Kitten TTS – 25MB CPU-Only, Open-Source TTS Model

https://github.com/KittenML/KittenTTS
789•divamgupta•22h ago•322 comments

More than two hard disks in DOS

https://www.os2museum.com/wp/more-than-two-hard-disks-in-dos/
5•userbinator•3d ago•0 comments

Writing a Rust GPU kernel driver: a brief introduction on how GPU drivers work

https://www.collabora.com/news-and-blog/blog/2025/08/06/writing-a-rust-gpu-kernel-driver-a-brief-introduction-on-how-gpu-drivers-work/
222•losgehts•11h ago•28 comments

You know more Finnish than you think

https://dannybate.com/2025/08/03/you-know-more-finnish-than-you-think/
61•infinate•2d ago•28 comments

A fast, growable array with stable pointers in C

https://danielchasehooper.com/posts/segment_array/
143•ibobev•9h ago•58 comments

The Bluesky Dictionary

https://www.avibagla.com/blueskydictionary/
119•gaws•7h ago•41 comments

Apple increases US commitment to $600B, announces American Manufacturing Program

https://www.apple.com/newsroom/2025/08/apple-increases-us-commitment-to-600-billion-usd-announces-ambitious-program/
24•Zenbit_UX•4h ago•10 comments

Running GPT-OSS-120B at 500 tokens per second on Nvidia GPUs

https://www.baseten.co/blog/sota-performance-for-gpt-oss-120b-on-nvidia-gpus/
4•philipkiely•1h ago•0 comments

301party.com: Intentionally open redirect

https://301party.com/
68•nahikoa•6h ago•13 comments

Out-Fibbing CPython with the Plush Interpreter

https://pointersgonewild.com/2025-08-06-out-fibbing-cpython-with-the-plush-interpreter/
23•Bogdanp•4h ago•0 comments

Multics

https://www.multicians.org/multics.html
102•unleaded•10h ago•21 comments

Show HN: HMPL – Small Template Language for Rendering UI from Server to Client

https://github.com/hmpl-language/hmpl
7•aanthonymax•17h ago•5 comments

Comptime.ts: compile-time expressions for TypeScript

https://comptime.js.org/
104•excalo•3d ago•17 comments

A Man Who Beat IBM

https://every.to/feeds/b0e329f3048258e8eeb7/the-man-who-beat-ibm
44•vinnyglennon•3d ago•14 comments

Breaking the sorting barrier for directed single-source shortest paths

https://www.quantamagazine.org/new-method-is-the-fastest-way-to-find-the-best-routes-20250806/
139•baruchel•13h ago•43 comments

The Inkhaven Blogging Residency

https://www.inkhaven.blog/
29•venkii•3h ago•27 comments

Zig Error Patterns

https://glfmn.io/posts/zig-error-patterns/
124•Bogdanp•12h ago•33 comments

Automerge 3.0

https://automerge.org/blog/automerge-3/
250•surprisetalk•3d ago•21 comments

AI in Search is driving more queries and higher quality clicks

https://blog.google/products/search/ai-search-driving-more-queries-higher-quality-clicks/
46•thm•10h ago•60 comments

Show HN: Sinkzone DNS – Forwarder that blocks everything except your allowlist

https://github.com/berbyte/sinkzone
72•dominis•11h ago•38 comments

Rethinking DOM from first principles

https://acko.net/blog/html-is-dead-long-live-html/
192•puzzlingcaptcha•21h ago•168 comments