Hacker News new | past | comments | ask | show | jobs | submit login
Keyword Generics Progress February 2023 (rust-lang.org)
14 points by orf 9 months ago | hide | past | favorite | 1 comment



On the /r/rust post, another user mentioned that having the effects be in the where clause (or in a separate effect clause) would likely look and feel much more like Rust:

    fn foo_finder<It, Cl, I>(iter: It, closure: It) -> Option<I>
    where
        It: Iterator<Item = I>,
        Cl: FnMut(&I) -> bool,
        fn: async if It: async + Cl: async,
        fn: const if Cl: const,
        fn: !panics if It: !panics + F2: !panics
    { /* ... */ }
or

    fn foo<F, T>(closure: F) -> Option<T>
    where 
        F: FnMut(&T) -> bool,
    effect 
        const if F: const,
        ?async,
    { /* ... */ }
I agree that the current ?const ?async syntax feels very messy.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: