Search found 2 matches
- Sun Oct 25, 2020 12:32 pm
- Forum: Object Oriented Programming
- Topic: masking public property?
- Replies: 2
- Views: 15451
masking public property?
I want to have some factory methods. A parameter of a shared method with the name of a instance property masks this property if it creates an instance. In the sample code an instance created by #createWrong has a public field #name insted of a property. :Class Text ∇ p←createOk name_ :Access Public S ...
- Sun Oct 25, 2020 11:55 am
- Forum: Object Oriented Programming
- Topic: Why is ⎕THIS in a shared method not deterministic
- Replies: 1
- Views: 12729
Why is ⎕THIS in a shared method not deterministic
When i call a public shared method from outside, ⎕THIS is a reference to the class.
If I call this shared method from an instance method of the same class, ⎕THIS is a reference to the instance.
As a workaround I use in my static method (↑⊃⊃⎕CLASS ⎕THIS) instead simply ⎕THIS.
If I call this shared method from an instance method of the same class, ⎕THIS is a reference to the instance.
As a workaround I use in my static method (↑⊃⊃⎕CLASS ⎕THIS) instead simply ⎕THIS.