On Tuesday, November 27, 2018 3:00:27 PM CST Levi Morrison wrote: > On Tue, Nov 27, 2018 at 11:36 AM Larry Garfield <la...@garfieldtech.com> wrote:
> > Looks like fun! > > > > Would this also include allowing a return type of `static`, which would be > > useful for the "Return the object that was invoked" case or "return a new > > instance of the same object" case? Currently we're limited to `return > > self`, which is, of course, not the same thing and less flexible. > > > > --Larry Garfield > > It does not. To be honest, I did not think of it until your question. On Tuesday, November 27, 2018 3:04:30 PM CST Marcos Passos wrote: > Supporting `static` return would come in handy to define interfaces for > immutable objects. Exactly the sort of use case I was thinking of. Or for builder objects, where you mutate the object in place and then return it. That's a common pattern, but return self and subclasses don't play that nicely there. Levi, is that something that could be reasonably added to this RFC or is that Hard(tm), like scalar/callable/etc? (I don't know that a static/self parameter declaration is even a thing, so it probably doesn't matter there; it does matter for returns, though.) --Larry Garfield
signature.asc
Description: This is a digitally signed message part.