Why is ⎕THIS in a shared method not deterministic

Writing and using Classes in Dyalog APL
Post Reply
Manuel Kassens
Posts: 2
Joined: Wed Apr 22, 2020 2:17 pm

Why is ⎕THIS in a shared method not deterministic

Post by Manuel Kassens »

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.
Vince|Dyalog
Posts: 439
Joined: Wed Oct 01, 2008 9:39 am

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

Post by Vince|Dyalog »

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
Post Reply