SE-0258: Property Delegates

This is a really interesting point. When I read this I started to think about the proposed feature quite differently.

We recently had a review about "static callables", for types which implement the function-call syntax. I mentioned in that thread that we might also like some kind of "static member-lookup" for objects which simply serve to forward to another object.

And then I consider this "property delegates" proposal. At its heart, it is a way to have a "transparent" wrapper object, where member lookups are forwarded to some other object. Why is that only important for properties? Wrapper objects are quite common in general - perhaps we should consider a more general interface for transparent wrappers.

Feature creep is always dangerous - it's the famous "artist's dilemma" - when is something good enough to ship? Still, I think the design space is quite large and very interesting, and we should take the time to explore it properly, because it may end up looking quite different to what has been proposed, and this one has proceeded extraordinarily quickly. I even mentioned during the pitch thread that things were moving so quickly that I couldn't quite figure out what the latest situation was or really digest the new features. Maybe I'm just dumb or slow or something, but I like to take my time to absorb and read the proposal several times.

Also, to quickly respond to @jawbroken 's point: it is true that a prototype for this existed some time ago. That said, I don't think it is entirely correct to say there have been "several years of thought and discussion" about this. There was a thing, and it was basically left to one side while the community and dev team focussed on more pressing issues. We're revisiting an old topic, that's true, but it isn't battle-tested by years of experience or anything.

I think I've already made clear my distaste about how quickly this proceeded to review - I don't want to harp on about it. The point of this comment was to note that transparent wrapper types in general are a useful feature, and could in some ways be seen as analogous to C++'s operator -> or operator *.

7 Likes