[swift-evolution] Proposal: Introduce User-defined "Dynamic Member Lookup" Types
Jean-Daniel
mailing at xenonium.com
Sun Dec 3 05:37:36 CST 2017
> …
> Beyond that, it is counterproductive to your goals, because it means that people are far less likely to use to use optional returns. Doing so (which produces a safer result) would cause a double tax in syntax, and would be a confusing jumble. I can’t bring myself to do the whole example above, one line - just converting member lookup syntax but not callable syntax - would end up:
>
> let y = np^.arange?^(24)^.reshape^?(2, 3, 4)
>
> If you made DynamicCallable also return optional it would be:
>
> let y = np^.arange?^(24)?^.reshape^?(2, 3, 4)!
>
> or something. This is such madness that no one would do that.
Optional is not the only swift error handling pattern. But I agree that making the dynamic fonction throw would also induce a readable cost due to the necessity to add try at each call site.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20171203/22fbc5c8/attachment.html>
More information about the swift-evolution
mailing list