For me, a noun is a property, a verb is a method. So `foo` is a property, `calculateFoo()` is a method.
For your specific question, `func signum() -> Self` returns `Self`, which can't be used in property. `var signum:Self { return self }` will generate an error "'Self' is only available in a protocol or as the result of a method in a class". So computed property can't be used here. Zhao Xin On Wed, Jul 5, 2017 at 7:57 PM, Jens Persson via swift-users < swift-users@swift.org> wrote: > Why is eg the BinaryInteger.signum() a method and not a computed property? > > public protocol BinaryInteger … { > /// Returns `-1` if this value is negative and `1` if it's positive; > /// otherwise, `0`. > /// > /// - Returns: The sign of this number, expressed as an integer of the > same > /// type. > public func signum() -> Self > } > > The Swift API Design Guidelines doesn't say very much about computed > property vs method with no arguments, but it seems like signum() violates > them, no? > > /Jens > > _______________________________________________ > swift-users mailing list > swift-users@swift.org > https://lists.swift.org/mailman/listinfo/swift-users > >
_______________________________________________ swift-users mailing list swift-users@swift.org https://lists.swift.org/mailman/listinfo/swift-users