Documented? ⎕NC puts # and ⎕SE refs in class 9.2.

General APL language issues

Documented? ⎕NC puts # and ⎕SE refs in class 9.2.

Postby petermsiegel on Mon Feb 13, 2023 12:30 am

What would lead one to expect jill and sam in the snippet below to have (extended) name class (⎕NC) 9.2? The documentation suggests that name class 9.2 is for class instances, GUI objects, .NET objects, etc. Should the documentation include refs to ⎕SE and # here (or under ⎕NC 9.1), or is this an uncaught infelicity? It would be very convenient for testing purposes for this to be codified (since it allows an easy way to validate ⎕SE or # passed to a function as arguments).

Code: Select all
)clear
clear ws
        )ns john                       ⍝ john: just an ordinary namespace
#.john
        jack←john                      ⍝ jack refs john
        jill←#                         ⍝ jill refs #
        sam←⎕SE                        ⍝ sam  refs ⎕SE 
        ⎕NC 'john' 'jack' '#' 'jill' 'sam'
9.1 9.1 ¯1 9.2 9.2
petermsiegel
 
Posts: 141
Joined: Thu Nov 11, 2010 11:04 pm

Re: Documented? ⎕NC puts # and ⎕SE refs in class 9.2.

Postby Vince|Dyalog on Wed Feb 15, 2023 4:29 pm

Hi Peter,

We count # and ⎕SE as objects like a form, for example. # and ⎕SE have methods and properties. In your example, jill and sam are very much like instances which are 9.2.

⎕se.⎕wg 'Type'
Session

#.⎕wg 'Type'
Root


'f' ⎕wc 'form'
fref←f

f.⎕wg 'Type'
Form


42 ⎕atx 'fref'
9.2

⎕nc ⊂'fref'
9.2

I will log a docs issue to make clear that references to # and ⎕SE are also 9.2.

Regards,

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

Re: Documented? ⎕NC puts # and ⎕SE refs in class 9.2.

Postby petermsiegel on Wed Feb 15, 2023 8:40 pm

Thanks. It makes sense. # and ⎕SE are odd, "polymorphic", beasts...
petermsiegel
 
Posts: 141
Joined: Thu Nov 11, 2010 11:04 pm

Re: Documented? ⎕NC puts # and ⎕SE refs in class 9.2.

Postby Morten|Dyalog on Thu Feb 16, 2023 7:27 am

Vince|Dyalog wrote:jill and sam are very much like instances which are 9.2.

I would go one step further and say that jill and sam are references to instances. Internally, # and ⎕SE are instances of the root and the session class (there can currently only be one of each). Both of these objects can have children, methods, and support events.

The Dyalog documentation is not clear enough about ⎕NC: This function classifies user defined names. We will be revising the documentation to be clearer about this. The two codes 0 and ¯1 should be understood as follows:

  • 0: The name is free or "available" for use
  • ¯1: The name cannot be used to name anything user-defined (#, ⎕SE, ⎕IO, 1.5, ...)
User avatar
Morten|Dyalog
 
Posts: 453
Joined: Tue Sep 09, 2008 3:52 pm


Return to Language

Who is online

Users browsing this forum: No registered users and 1 guest