How to declare a class

Writing and using Classes in Dyalog APL

How to declare a class

Postby neeraj on Sat Jan 04, 2014 6:56 pm

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).
neeraj
 
Posts: 82
Joined: Wed Dec 02, 2009 12:10 am
Location: Ithaca, NY, USA

Re: How to declare a class

Postby Morten|Dyalog on Sun Jan 05, 2014 7:39 am

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: 451
Joined: Tue Sep 09, 2008 3:52 pm

Re: How to declare a class

Postby Morten|Dyalog on Sun Jan 05, 2014 10:43 am

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.
User avatar
Morten|Dyalog
 
Posts: 451
Joined: Tue Sep 09, 2008 3:52 pm

Re: How to declare a class

Postby neeraj on Mon Jan 06, 2014 6:05 pm

Thanks Morten. That is the reason I could not find the change type.
neeraj
 
Posts: 82
Joined: Wed Dec 02, 2009 12:10 am
Location: Ithaca, NY, USA


Return to Object Oriented Programming

Who is online

Users browsing this forum: No registered users and 1 guest