Sections in Classes?

Writing and using Classes in Dyalog APL

Sections in Classes?

Postby MBaas on Mon Feb 06, 2012 5:28 pm

When editing a class, the tree-view in the left pane has a "Sections"-entry, but I could not find any explanation on how to create sections in the PDFs, and somehow I could not figure it out from menues etc. either, so I'd be happy if someone could comment on that...
User avatar
MBaas
 
Posts: 156
Joined: Thu Oct 16, 2008 1:17 am
Location: Gründau / Germany

Re: Sections in Classes?

Postby AndyS|Dyalog on Tue Feb 07, 2012 5:05 pm

We'll fix that omission !

However, a very brief summary follows:

A section is merely a control structure which allows you to group a block of lines together .. so that for example you can collapse them.
Since it is a control structure the rules regarding nesting with other control structures or functions hold.
If you want to define a section, then you have to have to type the ":section" and ":endsection" yourself.

So if I'm in the editor I see:

Code: Select all
[0]  foo
[1]  ⍝ this is an interesting line
[2] ├:section boring
[3] │Flatten←{⎕ml←3 ⋄ ⍷⍵}
[4] │⍝ loads of boring stuff which I'm not really
[5] │⍝ very interested in when tracing
[6] ├:endsection
[7]  ⍝ this gets interesting again
[8]  andy←1
[9]


and given that I don't want to see the boring section, I can toggle the outline and I get:

Code: Select all
[0]  foo
[1]  ⍝ this is an interesting line
[2] ┼:section boring
[7]  ⍝ this gets interesting again
[8]  andy←1
[9]


(I've done this on a tty version but the same applies equally to a Windows version)
User avatar
AndyS|Dyalog
 
Posts: 263
Joined: Tue May 12, 2009 6:06 pm

Re: Sections in Classes?

Postby MBaas on Tue Feb 07, 2012 5:29 pm

Cool, thanks. I assume that works only within fns, but not within classes, so that one could put several boring fns into a separate section? I think something like that (or perhaps user-defined jump-points (or 'labels' within the class) which would also be accessible for navigation in the tree-view could be interesting ;-)
User avatar
MBaas
 
Posts: 156
Joined: Thu Oct 16, 2008 1:17 am
Location: Gründau / Germany

Re: Sections in Classes?

Postby MBaas on Tue Feb 07, 2012 11:35 pm

Bug-Report:
Ok, a section can also contain several functions BUT all functions defined in a section disappear from the "Methods"-branch of the treeview!
User avatar
MBaas
 
Posts: 156
Joined: Thu Oct 16, 2008 1:17 am
Location: Gründau / Germany

Re: Sections in Classes?

Postby AndyS|Dyalog on Wed Feb 08, 2012 3:04 pm

Logged as such
User avatar
AndyS|Dyalog
 
Posts: 263
Joined: Tue May 12, 2009 6:06 pm


Return to Object Oriented Programming

Who is online

Users browsing this forum: No registered users and 1 guest