Remix.run Logo
vermilingua 5 hours 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

kibwen 5 hours ago | parent | next [-]

If 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 5 hours ago | parent [-]

Could!

> Everything Rust has … expressed as s-expressions. No semantic gap.

thatxliner 2 hours ago | parent | prev | next [-]

You can also drop into direct Rust with the (rust "...") macro if I forgot to implement anything

kccqzy 3 hours ago | parent | prev | next [-]

The HRTB is probably the trickiest syntax for specifying lifetimes. It looks like `for<'a> F: Fn(&'a (u8, u16)) -> &'a u8`.

stdatomic 3 hours ago | parent [-]

Can you translate this for those of us who don't speak rust?

Xirdus 3 hours ago | parent [-]

Type 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...

andrepd 5 hours ago | parent | prev [-]

It's a vibecoded parser...

gleenn 3 hours ago | parent [-]

Technically it's a transpiler.