News for hackers. Stuff that matters.

jshxr

Re:Use Your Type System on Thursday July 24, 2025 @11:43AM (#44672097)
Unfortunately, this can be somewhat awkward to implement in certain structural typed languages like TypeScript. I often find myself writing something along the lines of

  type UserID = string & { readonly __tag: unique symbol }
which always feels a bit hacky.
Re:Use Your Type System on Thursday July 24, 2025 @11:32AM (#44671965)
I've seen it being referred to as "New Type Pattern" or "New Type Idiom" in quite some places. For example in the rust-by-example book [1].

[1] https://doc.rust-lang.org/rust-by-example/generics/new_types...

Re:Show HN: Hyvector – A fast and modern SVG editor on Saturday May 10, 2025 @10:07AM (#43945753)
Very cool! A few notes:

- I really like the level of fine-grained control, even for changes that don't visibly affect the output, like reversing a path. For that case, some visual feedback would help, since it's hard to tell if it worked

- Copying a selection to the clipboard seems to include all fonts used in the scene (even if not selected) as base64 in the SVG, leading to a bloated output

Do you plan to keep the strict 1:1 mapping with SVG, or are you open to some abstractions? I still use Figma for creating SVGs because of one killer feature I can't work without anymore: Vector Networks [1]. They'd need some internal conversion to valid path data, but it's an abstraction that could add real value.

On the technical side, I'm surprised the editor uses SVG for rendering. Although of course it makes sense, I half expected it to use canvas under the hood. Lately I've been experimenting with rendering simple 3D objects using SVG and ran into performance issues pretty quickly, though I'm not yet sure what exactly' is causing them.

Did you do any stress testing yet, especially on older devices?

[1] https://www.figma.com/blog/introducing-vector-networks/

Ask HN: Why is the source folder called 'src'?

Many languages and frameworks advocate (or even enforce) a standard folder structure that includes a 'src' folder. I always found 'src' to be quite "ugly" and also possibly confusing to beginners, who might think it's an abbreviation of a multi-word phrase instead of a contraction. In the end, it only reduces the word by 3 letters. Why isn't it simply called 'source'? Does it have historic...

( Read More... | 15 comments | 7 points | on HN )