Quuxplusone added a comment.

Probably irrelevant comment from the C++ world: If I needed this concept in 
C++, I'd probably piggyback on the existing semantic analysis of `std::move`: 
I'd design a `class OnceCallable` with an `operator() &&` that both called and 
nulled-out its object parameter, and then call it like 
`std::move(myCallback)()`. Then if I ever tried to call it a second time, the 
static analyzer would (hopefully) complain that I was accessing a moved-from 
`myCallback`. But you want this for existing APIs that take the built-in block 
type, so never mind. :)

Probably irrelevant scope creep: Is it worth trying to support the possibility 
that someone might want to pass both a `successHandler` and a `failureHandler`, 
with the invariant that we'd make //exactly one call to one of them// (but 
never call both)? Is that just not a thing that ever happens in NSWhatever?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92039/new/

https://reviews.llvm.org/D92039

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to