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

Joe DeCapo snoogansbc at gmail.com
Thu Dec 7 10:21:57 CST 2017


> On Dec 7, 2017, at 10:12 AM, Letanyan Arumugam via swift-evolution <swift-evolution at swift.org> wrote:
> 
> My original argument about failing for no discernible reason still stands. precondition is a thought out check for a failing state. member lookup failures are going to be because things don’t exist for which you presumably expected to exist.

Is it necessarily true that things will have to fail "for no discernible reason"? It's up to the implementers of the protocol for how they want to handle the failure case (trap/return option/throw error/etc.). But I imagine it could be possible to add a generic debug error message/warning message about lookup failing for invocations of this kind, which would give a pretty clear hint about what went wrong and why. Would that be enough to address your concerns about silent failures?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20171207/42257efd/attachment.html>


More information about the swift-evolution mailing list