Why is ⎕THIS in a shared method not deterministic

Writing and using Classes in Dyalog APL

Why is ⎕THIS in a shared method not deterministic

Postby Manuel Kassens on Sun Oct 25, 2020 11:55 am

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.
Manuel Kassens
 
Posts: 2
Joined: Wed Apr 22, 2020 2:17 pm

Re: Why is ⎕THIS in a shared method not deterministic

Postby Vince|Dyalog on Mon Oct 26, 2020 12:34 pm

Hi Manuel,

I think this is working as designed--that when you are in an instance method, the current namespace that ⎕THIS will refer to is that instance.

Regards,

Vince
Vince|Dyalog
 
Posts: 335
Joined: Wed Oct 01, 2008 9:39 am


Return to Object Oriented Programming

Who is online

Users browsing this forum: No registered users and 1 guest