> … > 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.
_______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution