3 ms·
Claims to have all the syntax covered, but not a single example of specifying lifetimes or the turbofish, some of the trickiest rust syntax
by vermilingua 5mo ago
Claims to have all the syntax covered, but not a single example of specifying lifetimes or the turbofish, some of the trickiest rust syntax
- andrepd 5mo agoIt's a vibecoded parser...
- gleenn 5mo agoTechnically it's a transpiler.
- kibwen 5mo agoIf you already have the ability to express the grammar productions in Rust that allow for optionally-specified types (e.g. variable declaration), then you have the ability to express lifetimes and the turbofish (which is just a curious way to call a generic function with a specific type parameter). The only weird thing would be that Lisp uses the apostrophe character for something very different than Rust, but you could just pick any other way to denote lifetimes.
- vermilingua 5mo agoCould! > Everything Rust has … expressed as s-expressions. No semantic gap.
- kccqzy 5mo agoThe HRTB is probably the trickiest syntax for specifying lifetimes. It looks like `for<'a> F: Fn(&'a (u8, u16)) -> &'a u8`.
- stdatomic 5mo agoCan you translate this for those of us who don't speak rust?
- Xirdus 5mo agoType F must be a function that's generic over any possible lifetime 'a, with a single argument that's a reference with lifetime 'a to a tuple of two numbers, and returns a reference with the same lifetime 'a to an 8-bit number. The full code is usually something like: fn foo<F>(callback: F) where for<'a> F: ... Which is a generic function foo that takes the argument of type F, where F must be...
- thatxliner 5mo agoYou can also drop into direct Rust with the (rust "...") macro if I forgot to implement anything