Code: Select all
class Test
{
method() {
this.property := "some value" ;// set
this.another_method() ;// call
}
}
;// OR
function(obj) {
obj.property := "some value"
obj.another_method()
}
Code: Select all
class Test
{
method() {
.property := "some value" ;// set
.another_method() ;// call
}
}
;// AND / OR
function(obj) {
.property := "some value"
.another_method()
}
PROS:
- Ensures that the call always invokes the invoked object even if the variable that refers to that object (in most cases this) is assigned a different value. Kinda similar to the usage/purpose of the LastFoundWindow.
- Shorter and IMHO more understandable -> OK, this line is invoking the object that called this method(no need to look-up the value of this or whatever variable).
- Could be unfriendly to the eyes
- Might not be readable to others
- Error prone?? Delete the dot and it does something totally different.