How to declare a class

Writing and using Classes in Dyalog APL
Post Reply
neeraj
Posts: 82
Joined: Wed Dec 02, 2009 12:10 am
Location: Ithaca, NY, USA

How to declare a class

Post by neeraj »

I am missing something obvious. If I start with a clear workspace and want to create a class, what steps do I have to follow?

Typing a ClassName and double clicking it and trying to enter class definition does not work (It treats it as a function).
User avatar
Morten|Dyalog
Posts: 460
Joined: Tue Sep 09, 2008 3:52 pm

Re: How to declare a class

Post by Morten|Dyalog »

To start the editor on a new class, put a ○ (circle, ctrl-o) before ClassName:

      )ed ○ClassName

The full list of prefix characters that you can use to start the editor in a particular mode is:

      ∇ function/operator 
→ simple character vector
∊ vector of character vectors
- character matrix
⍟ Namespace script
○ Class script
∘ Interface

You can pull the list up when you need it by typing )ed in the session and hitting F1 to bring up the on-line help. I could have sworn there was a way to change the type of an existing object, but now I can't find it. I'll be back if I manage to dig it up.
User avatar
Morten|Dyalog
Posts: 460
Joined: Tue Sep 09, 2008 3:52 pm

Re: How to declare a class

Post by Morten|Dyalog »

It turns out the mechanism for changing type within the editor has been removed, pending a rewrite to allow it to properly handle the "recent explosion" in types. The rewrite has yet to happen.
neeraj
Posts: 82
Joined: Wed Dec 02, 2009 12:10 am
Location: Ithaca, NY, USA

Re: How to declare a class

Post by neeraj »

Thanks Morten. That is the reason I could not find the change type.
Post Reply