[swift-evolution] Proposal: Introduce User-defined "Dynamic Member Lookup" Types

Chris Lattner clattner at nondot.org
Tue Nov 28 22:45:41 CST 2017


> On Nov 28, 2017, at 1:55 PM, Ben Rimmington <me at benrimmington.com> wrote:
> 
> I suggest using different subscripts for function/method calls and properties:
> 
> * `value(...)`      ==> `value[dynamicFunction: ""](...)`
> * `value.name(...)` ==> `value[dynamicFunction: "name"](...)`
> * `value.name`      ==> `value[dynamicProperty: "name"]`
> 
> Dynamic callable types have an unnamed method.
> Dynamic argument labels are always allowed (but can be ignored).
> For example, the labels of `Date.UTC` below are not passed to JavaScript.

Hi Ben,

This proposal has nothing to do with “callables”, just dynamics member lookup.  The other proposal: https://gist.github.com/lattner/a6257f425f55fe39fd6ac7a2354d693d <https://gist.github.com/lattner/a6257f425f55fe39fd6ac7a2354d693d> (which I need to revise a bit) relates to dynamic callable stuff, and it does in fact have a “DynamicCallableWithKeywordsToo” form that provides what you are asking for IIUC.

There is no need to model calls as subscripts though, because syntactic calls in swift (intentionally) do not produce lvalues.

-Chris

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20171128/b5d84296/attachment.html>


More information about the swift-evolution mailing list