Instance with no parent

Writing and using Classes in Dyalog APL
Post Reply
User avatar
giangiquario
Posts: 46
Joined: Thu Nov 26, 2009 8:55 am
Location: Milano, Italia

Instance with no parent

Post by giangiquario »

I met a condition where an instance had no parents.
In fact - inside a Destructor function -
⎕this
returned
.[myClass]
and
⎕this.##
returned
DOMAIN ERROR

Is it a possible state of an instance or did I do something wrong?
User avatar
Morten|Dyalog
Posts: 460
Joined: Tue Sep 09, 2008 3:52 pm

Re: Instance with no parent

Post by Morten|Dyalog »

I can't think of a way in which this could happen - would be very interested to see code that could reproduce it!
User avatar
giangiquario
Posts: 46
Joined: Thu Nov 26, 2009 8:55 am
Location: Milano, Italia

Re: Instance with no parent

Post by giangiquario »

I squeezed the class that created that situation and prepared a simple .DWS
The workspace (dyalog 11.1) is attached.

Instructions:

(⎕NEW morten.first).Play

In form “first class” press button “Input data”.
In form “aaaaaaaaa” press button “Quit”
In form “fist class” press button “Quit”

DOMAIN ERROR
kill[3] parentName←⍕⎕THIS.##


PS. I'm sorry. I tried to upload the DWS but I cannot find it in this post.
User avatar
Morten|Dyalog
Posts: 460
Joined: Tue Sep 09, 2008 3:52 pm

Re: Instance with no parent

Post by Morten|Dyalog »

The forums have a pretty restrictive policy about the document types that can be uploaded. I have added both .DWS and .DYALOG to the list, and it now seems possible to attach workspaces. Yours is attached: We will investigate your problem, it does seem a little mysterious. Thanks for the report and the repro!
Attachments

[The extension dws has been deactivated and can no longer be displayed.]

Erik.Friis
Posts: 66
Joined: Mon Apr 04, 2011 3:16 pm

Re: Instance with no parent

Post by Erik.Friis »

Is there a difference between using ##.[]THIS and []THIS.## ? I have been using the former im my code, but perhaps the latter more correct.
User avatar
JohnD|Dyalog
Posts: 74
Joined: Wed Oct 01, 2008 9:35 am

Re: Instance with no parent

Post by JohnD|Dyalog »

Hi Erik,

##.⎕this and ⎕this.## should be equivalent. It's entirely your preference which you choose to use.

Best Regards,
John Daintree
Post Reply