My understanding of the difference between getter method and getter property is the latter is the attribute of given type, something that you can just read. The former on the other hand is something you (painfully or not) compute.
It really annoyes me that in C# you have for example the method
IEnumerable (granted, as an extension) and you have
Count property for such collection as
Let’s think in terms of refinement — when you have a method in your base type you can refine it in any derived type, but if at some stage you could guarantee no actual computation takes place you would be sending the wrong signal. Internally you have just a fetch operation, for the outer world you are still struggling with some number crunching. That is why Skila allows to refine a method as a property.
interface Sequence<out T> // here we compute base def count() Int ••• end class !Array<T> extends Sequence<T> // here we just read extends def count Int ••• end
And to make using properties as pleasant as possible Skila goes the opposite way than Scala — it is possible to call a property like a function but not the other way around:
let seq ~Int = [ 1, 2, 3 ]; _ = seq.count(); // invalid in Skila, valid in Scala _ = seq.count; let coll [Int] = [ 1, 2, 3 ]; // both target the property _ = coll.count(); // invalid in Scala _ = coll.count;