News for hackers. Stuff that matters.

bietroi

Show HN: Typegraph – type-level graphs of Rust types

https://github.com/nicksenger/typegraph

Hi r/rust,I wanted to share with the community a Rust library I started a little while ago called typegraph. It lets you build graphs of types in the type system, for static analysis and stuff like that.It's the fourth entry in my "Beginner Crates" series, which are crates made for computers learning to code all by themselves.You can also use it to make diagrams like this one of...

( Read More... | no comments | on HN )
Oh, that's pretty funny actually.

In retrospect, if I cared about getting peoples' attention I should have mentioned something about "static reflection", or positioned this as more of a direct "threat" to macro expansion (and made it opt-in instead of opt-out, I forgot how frightened people are by any new ability to infer things).

I'm just a coder, not an influencer, though I do have one additional change in mind which borders on sensationalism.

Show HN: Inception: Automatic Rust Trait Implementation by Induction

https://github.com/nicksenger/Inception

Hi HN,I thought this would be a good place to share a little puzzle I've been working on. Inception is a Rust library that helps you share behaviors in Rust using structural induction. Practically, this means that instead of having a derive macro for each behavior, a single derive can be used to enable any number of behaviors. It doesn't do this using runtime reflection, but rather...

( Read More... | 2 comments | on HN )
It's cool to see that others have explored some of these concepts more generally, thanks for the links!

The glowstick shape is also a type-level list of integers, and I could definitely see how other shapes might be useful in different situations.

Doing this sort of thing in Rust is a bit of a stretch for sure, but it makes the outcome easy to apply which is nice.

Glowstick just provides the shape types and associated traits as a layer you can put on top of another tensor implementation. Since it's just verifying shapes and forwarding the operations to the underlying tensor (e.g. from candle/burn), I don't think there's any great way to get performance benefits from these integrations. It's mainly about the developer experience- getting errors at compile time vs runtime, checking shapes, etc.

That being said, it seems reasonable that you could make some optimizations like this if you had deeper integration of these types with a framework or similar. It's not something I've explored personally, sounds interesting though.

Show HN: Glowstick – type level tensor shapes in stable rust

https://github.com/nicksenger/glowstick

Hi HN,In the past few years I've become more interested in machine learning. Since I'm sure the same is true for many here, I wanted to share this project I've been working on: glowstick uses type-directed metaprogramming to keep track of tensor shapes in Rust's type system and determine which operations are permitted or not at compile time.I find Rust has a lot of strengths...

( Read More... | 5 comments | 9 points | on HN )

Show HN: I made a web app for language learners using Rust->WASM->Canvas

https://synchrotales.com

Hi HN,I am an intermediate Vietnamese learner who wanted a way to ease into studying native materials without getting too overwhelmed, so I made SynchroTales. It allows you to:- View parallel texts - Click a word to see its definition - Double-click a word to play the audiobookMy background is mainly UI: most recently Desktop apps using Rust & Iced (an Elm inspired GUI lib). I thought this...

( Read More... | no comments | on HN )