#rust-lang

/

      • ubsan
        yes
      • there are less ideal solutions which are better than the current solution
      • for example, mtgs which are open to all, but only a few talk
      • or even just bloody notes
      • jntrnr
        I wonder how many people would show up if they could
      • ubsan
        I and WindowsBunnyGhostBusters
      • jntrnr
        trying to manage a meeting with a dozen people wanting to talk kinda sucks
      • ubsan
        are the two who really want to show up
      • jntrnr
        I don't doubt there are others also
      • ubsan
        we're the ones who are complaining about the closed meeting :P
      • jntrnr
        heh
      • fair
      • jntrnr is also not in those meetings
      • WindowsBunnyGhostBusters
        jntrnr: C++ does pretty fine with large meetings
      • jntrnr
        WindowsBunnyGhostBusters: they've developed a lot of structure to support it
      • ubsan
        jntrnr: that's not a good excuse
      • jntrnr
        not an excuse :-/
      • just sayin'
      • WindowsBunnyGhostBusters
        jntrnr: Since Rust definitely doesn't have a shortage of accepted RFCs that need implementing, I'd say a committee process would be great
      • it would slow down the RFC process for sure
      • jntrnr
        I *am* glad the committees we do have don't cost money to be part of
      • unlike ECMAScript and C++
      • jntrnr has to go eat dinner... *poof*
      • WindowsBunnyGhostBusters
        well the meetings are open to everyone, you just have to pay to be a member which gives you more voting rights
      • ubsan
        jntrnr: the C++ committees don't cost money to be a part of
      • they're volunteer
      • WindowsBunnyGhostBusters
        >Meetings are open to the public, and we welcome people to attend for a meeting or two as an observer; this lets you participate and argue and do most everything, except only you can’t actually participate in change approval polls.
      • ubsan
        and technically, nobody gets a vote except for the teams
      • in Rust
      • which means, mozilla gets all the votes :)
      • WindowsBunnyGhostBusters
        so if we just had open meetings over the internet where only the teams got to vote, but anyone could participate, we'd be on par with C++
      • and then it would just be a matter of scaling it up
      • ubsan
        except that everybody on the lang team seems to be paid by the same company...
      • well, 'cept for huonw
      • so, everybody but 1
      • no other company has any power
      • ... yayyyy...
      • locallycompact has quit
      • WindowsBunnyGhostBusters
        ubsan: I wonder if we opened it up so anyone could pay to be part of the team, would anyone take up that offer?
      • ubsan
        I doubt it would work
      • at least until we get something like https://isocpp.org/
      • scott
        I'd like to see other companies have more power if in combination they also contribute in important ways
      • ubsan
        scott: right
      • arielby has quit
      • jntrnr
        ubsan: sure, though Rust is like a year old?
      • not that the concerns aren't valid
      • just things take time to mature generally
      • C++ took a while to get there (years) and for C# etc
      • ubsan
        jntrnr: that's true
      • this is more complaining based on being locked out
      • jntrnr
        yeah
      • SilverKey joined the channel
      • aturon
        Gankro: yes, we've emailed Duffy
      • Gankro
        👍
      • Ericson2314 joined the channel
      • Ericson2314 has left the channel
      • Ericson2314 joined the channel
      • jseyfried joined the channel
      • SilverKey has quit
      • SilverKey joined the channel
      • eddyb
      • does it allow passing a templated function around with the template unapplied?
      • or maybe it has to be a templated operator() of a monomorphic class
      • ubsan
        eddyb: templated function around with the template unapplied?
      • like
      • fn<T>(T)?
      • I imagine so
      • eddyb
        ubsan: like given template<typename T> T foo() { return T(); }, passing foo around
      • not as a function pointer but as a callable
      • I don't think C++ lets you do this, but I'm not sure
      • ubsan
        you need SFINAE
      • and HKT
      • so
      • eddyb
        with closures it works because this works:
      • struct foo { template<typename T> T operator() { return T(); } } and then passing foo{} around
      • although, *that* definition might be wrong
      • it should work fine with generic arguments
      • ubsan
        template <template<typename> class F> int foo(F f) { static_if(std::is_callable<F<int>, int>::value, "Must be callable with no args returning int"); return F<int>(0); }
      • eddyb: ^
      • oh wait
      • eddyb
        ubsan: no, that's not really what I mean
      • ubsan
        template <template<typename> class F> int foo(F f) { static_if(std::is_callable<F<int>, int, int>::value, "Must be callable with one arg (int) returning int"); return F<int>(0); }
      • eddyb: SFINAE is C++'s bounds
      • eddyb
        ubsan: I mean template<typename F> which can then be used as a generic closure
      • ubsan
        huh?
      • no
      • it has to be higher kinded, I think
      • eddyb
        ubsan: C++ has generic closures anyway
      • without higher kindedness
      • I just don't think you can use templated functions like that
      • ubsan
        .clang { cout << foo(doop); } template <typename T> T doop(T t) { return t; } template <template<typename> class F> int foo(F f) { static_if(std::is_callable<F<int>, int, int>::value, "Must be callable with one arg (int) returning int"); return F<int>(0); }
      • ticki
        Is it really worth it though? To cover a simple edgecase, when it can effectively be solved by higher kinded polymorphism.
      • eddyb
        ticki: they're not the same thing
      • ticki
        Well, they are.
      • You can parameterize closures over type lambdas.
      • eddyb
        ticki: functions are not higher-kinded, they're higher-ranked
      • ticki
        Then the application infers these and performs η-reduction.
      • eddyb
        *generic functions
      • ticki
        eddyb: type lambdas, not lambdas.
      • eddyb
        ticki: how is that relevant to the discussion
      • ticki
        Well, say some closure is parameterized over some arbitrary type, that's generics.
      • eddyb
        (or rather, generic functions can have parameters which add to their kind - early-bound - or parameters which add to their rank - late-bound)
      • ticki
        HKP allows for such a parameterization.
      • eddyb
        ticki: for lifetimes, we couldn't force that, it would've broken stuff
      • or rather, it would've made e.g. fn(&T) impossible to obtain
      • ticki
        Yeah, lifetimes are sort of weird in this case, especially due to subtyping relations.
      • eddyb
        should they be special though?
      • ubsan
        yeah?
      • I think they should be
      • eddyb
        ubsan: so you're against generic closures?
      • ubsan
        eddyb: no
      • ticki
        If you want full expressiveness, yes.
      • eddyb
        because generic closures are higher-ranked, not higher-kinded
      • ubsan
        I just think that lifetimes are special
      • ticki
        for<'a> is basically a type-lambda constraint to a region.
      • eddyb
        AFAICT, ticki is saying that higher-ranked for types is unnecessary because you can do higher-kinded
      • ticki
        Well, not really.
      • eddyb
        but higher-kinded is annoying to work with
      • ticki
        My point is that one falls from the other.
      • ubsan
        well, higher-ranked for types is impossible because different types can make codegen different
      • ticki
        eddyb: How so? Type inference makes stuff relatively easy.
      • eddyb
        it's necessary in some cases, but not most of the usual ones
      • ubsan
        as I understand it
      • ticki
        ubsan: No, it shouldn't affect codegen.
      • eddyb
        ubsan: not on function pointers, but on generic bounds
      • ubsan
        ticki: it should though
      • ticki
        Oh, well. The type constructors, you mean?
      • ubsan
        fn(T), depending on T, should result in different code
      • ticki
        Because those affects codegen. I get your point.
      • Yeah
      • ubsan
        whereas fn(&'a T), depending on 'a, does not
      • eddyb
        typeof Clone::clone: for<T: Clone> Fn(&T) -> T
      • Ericson2314
        still confused on why early-late matters unless one turns the closure to a trait object
      • eddyb
        Ericson2314: that's not what early-late is about
      • ticki
        eddyb: I guess typeck would go something like:
      • eddyb
        Ericson2314: early-late is kind-rank
      • Ericson2314: HRTB, not for<...> Trait or for<...> fn()
      • ticki
        Figure the rhs to be λx: Clone.&T → T.
      • Ericson2314
        i realize
      • eddyb
        Ericson2314: you cannot use HRTB with early-bound parameters
      • ticki: did you mean to use &x -> x?
      • Ericson2314
        that would be a restriction on the *consumer* of the closure, no?
      • ticki
        Yeah
      • Ericson2314
        or are we no longer talking about generic closure creation?
      • ticki
        We are.
      • Ericson2314
        imma ready eddyb's post again then
      • scott
        eddyb: not sure if this was clarified earlier: I believe C++17 has generic closures (with `auto` argument types) - but they are, as far as I know, restricted to local scopes so you don't get into higher-ranked situations
      • I'd be interested to see if I'm wrong about the latter
      • Ericson2314
        eddyb looking at your comment, there are no additional restrictions from writing out the closure as a struct by hand?
      • but may be worthwhile to remove the "no impl<T> Fn() for X" for manual impls and closures?