tildeio / helix

Native Ruby extensions without fear
https://usehelix.com
ISC License
1.98k stars 60 forks source link

Declaring lifetimes in Helix class structs? #145

Open dtpowl opened 6 years ago

dtpowl commented 6 years ago

I need to do something along these lines:

ruby! {
    class Foo {
        struct { bar: Bar<'a> }
     }
}

But of course this doesn't work, because the lifetime 'a hasn't been declared. But I can't figure out where/how to declare it. In a normal Rust struct, I could say struct Baz<'a> { bar: Bar<'a> }, of course, but the anonymous-struct Helix syntax doesn't give me a place to put the lifetime declaration. I've tried a handful of different things but they all result in the macro-expansion failing.

Am I missing something? Is this just a missing feature at the moment?

chancancode commented 6 years ago

You are correct, this is a missing feature at the moment. There are some pending parser changes that need to be merged first, but I'll work on this next.