akin icon indicating copy to clipboard operation
akin copied to clipboard

Support for separators

Open Airtz opened this issue 3 years ago • 1 comments

Hi @LyonSyonII

As of now I don't think there is a good way to express some repetitions:

impl<T> Foo for T where T: Baz<A> + Baz<B> + ... {}

//We could do
akin! {
    let &Type = [B, ...];
  
    let &bound = { + Baz<*Type> };
  
    impl<T> Foo for T where T: Baz<A> *bound {}
}

//Or
akin! {
    let &Type = [A, B, ...];
  
    let &separator = [NONE, +, ...]

    let &bound = { *separator Baz<*Type> };
  
    impl<T> Foo for T where T: *bound {}
}

It would be nice to be able to specify a separator. Maybe something along those lines:

akin! {
    let &Type = [A, B, ...];
  
    let &bound = { Baz<*Type> };
  
    impl<T> Foo for T where T: *{+}bound {}
}

Airtz avatar Mar 29 '22 16:03 Airtz

The first option would be the cleanest for me (and the currently intended).

I don't think there is a real necessity for adding the feature (I prefer the simplest syntax possible), but you can make a PR if you want.

LyonSyonII avatar Mar 29 '22 17:03 LyonSyonII