Regards Letanyan Arumugam
> On 07 Dec 2017, at 21:07, Chris Lattner <clatt...@nondot.org> wrote: > > >> On Dec 7, 2017, at 7:15 AM, Letanyan Arumugam via swift-evolution >> <firstname.lastname@example.org <mailto:email@example.com>> wrote: >> >> >> >>> On 07 Dec 2017, at 17:02, Xiaodi Wu <xiaodi...@gmail.com >>> <mailto:xiaodi...@gmail.com>> wrote: >>> >>> >>> On Thu, Dec 7, 2017 at 00:37 Letanyan Arumugam via swift-evolution >>> <firstname.lastname@example.org <mailto:email@example.com>> wrote: >>> >>>> This seems marginally tolerable, but excessive. >>>> >>>> Do we mark every usage of a type that can generate precondition failures >>>> or fatal errors for reasons other than “no such method?” No, we don’t. >>>> >>> >>> fatalError shouldn’t be used excessively. API surface areas for these types >>> are going to be massive (infinite technically). I assume many people are >>> going to be writing a lot of code would these types and calling many >>> methods and properties which would all essentially have a fatalError. Would >>> you consider it good code if the majority of all your types had methods >>> defined with fatalError calls. >>> >>> What is the basis for this claim? Probably the majority of standard library >>> methods check preconditions and trap on failure. That is how I write my >>> code as well. >>> >> >> I’m talking specifically about fatalError not precondition. fatalError is >> something that goes out with production code while precondition is used for >> debugging. I think you would agree a shipped program that has many states of >> being unrecoverable is not a good design? > > You are aware that Int traps on overflow and arrays trap on out of bounds, > right? > Were each of them not decided upon separately based on certain tradeoffs? Arrays for speed and Int overflow because having the addition operator return an optional would be too cumbersome? If these reasons were not so influential would they still be designed to trap?
_______________________________________________ swift-evolution mailing list firstname.lastname@example.org https://lists.swift.org/mailman/listinfo/swift-evolution