Page 1 of 1

How to declare a class

Posted: Sat Jan 04, 2014 6:56 pm
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).

Re: How to declare a class

Posted: Sun Jan 05, 2014 7:39 am
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.

Re: How to declare a class

Posted: Sun Jan 05, 2014 10:43 am
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.

Re: How to declare a class

Posted: Mon Jan 06, 2014 6:05 pm
by neeraj
Thanks Morten. That is the reason I could not find the change type.