I appreciate your support but looks like this proposal is going nowhere. This proposal affects fundamental habits that are very hard to argue with. Never the less I will keep using this property in my code because my team is okay with it.
Thanks, Anton Mironov > 6 черв. 2016 р. о 21:42 Thorsten Seitz <[email protected]> написав(ла): > > That's just the way it was done in Smalltalk. Very readable IMHO as I'm not a > fan of `!` either for the reasons you cited. > > -Thorsten > > Am 21.05.2016 um 16:50 schrieb Антон Миронов via swift-evolution > <[email protected] <mailto:[email protected]>>: > >> I found negation operator (!) the least detectable among the code. So I’ve >> decided to add property “not” to BooleanType (Swift 2.2) or Boolean on 3.0 >> with extension: >> >> extension BooleanType { >> var not: Bool { return !self.boolValue } >> } >> >> This is code with negation operator: >> return !self.lanes[position.y][currentLaneRange].contains(.Gap) >> >> As I sad before negation operation is hard to spot. Moreover at first it >> looks like I’m trying to negate self for some reason. >> >> This is code with “not” property: >> return self.lanes[position.y][currentLaneRange].contains(.Gap).not >> >> Now it is easy to spot the statement I am actually getting negation of. >> On my experience negation operator can occasionally be missed while reading >> code. This happens less often with “not” property. So I’m proposing to add >> this property to standard library and prefer it in most cases. >> >> Thanks, >> Anton Mironov >> >> _______________________________________________ >> swift-evolution mailing list >> [email protected] <mailto:[email protected]> >> https://lists.swift.org/mailman/listinfo/swift-evolution >> <https://lists.swift.org/mailman/listinfo/swift-evolution>
_______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
