Surrounding Namespace Confusion...

Writing and using Classes in Dyalog APL

Surrounding Namespace Confusion...

Postby Erik.Friis on Tue Apr 05, 2011 8:55 pm

From the manual:

Associated with a Class (or an instance of a class) there is a completely separate
namespace which surrounds the class and can contain functions, variables and so forth
that are created by actions external to the class.


I see that I can do a )CS from # into a namespace that is the same as my instance or class name. I cannot use )vars or []nl 2 or []nl -2 to see any variables (fields). I cannot type a variable/field name to get a value, but I can double click on the name (as well as the name of the constructor) and then see it in an edit window. I understand that I can assign a value (from outside the object) that is not defined in the class and then see it in the NS (e.g. Foo.Junk<-3), then I will see Junk with )vars and I can type the name and see it's value. Seems to me this would be very bad programming practice or an easy mistake to make.

So can anyone explain the purpose of the "surrounding" namespace and why I can't see my fields/methods? I suspect this may be a vestige of the older GUI objects, but the current implementation retrofit on the OOP extension seems counterintuitive to me. I'm hoping someone can explain clarify. Thanks!
Erik.Friis
 
Posts: 66
Joined: Mon Apr 04, 2011 3:16 pm

Return to Object Oriented Programming

Who is online

Users browsing this forum: No registered users and 1 guest