
-----------------------------------
TheOneTrueGod
Thu Jun 08, 2006 4:36 pm

Anonamously referencing procedures within a class
-----------------------------------
I don't know if I used the terminology right there, but eh.


class Stuff
export WriteThis

   procedure WriteThis (s : string)
      put s
   end WriteThis
   procedure WriteFirstCharacter (s : string)
      put s(1)
   end WriteFirstCharacter
end Stuff


Allright, now if I wanted to anonamously reference that procedure, is there any way to go about doing that?


%Imaginary Syntax to show what I want to do
var q : array 1..2 of procedure p (s : string)
q(1) := Stuff.WriteThis
q(2) := Stuff.WriteFirstCharacter


Is there any possible way to do this?  I've tried creating a pointer to the class, and assigning q to the procedure that way, but it didn't work...

-----------------------------------
HellblazerX
Thu Jun 08, 2006 4:42 pm


-----------------------------------
I understand what you're asking.  I believe what you're looking for is an abstract class, or an abstract procedure, however, since I've never looked into Turing classes, I'm not sure if they exist in Turing.

-----------------------------------
Cervantes
Thu Jun 08, 2006 5:11 pm


-----------------------------------
No, you can't do that. The reason being that those procedures only exist for instances of the Stuff class, not for the class itself.

What you're looking for is a .

-----------------------------------
TheOneTrueGod
Thu Jun 08, 2006 5:48 pm


-----------------------------------
Darn. Thanks for your help man.  A module wouldn't be useful in the instance I was asking this about.  (Unfortunately, I forgot the instance  :oops:  I was trying to figure out a way around it for like a week, so I finally gave up and posted the question on here, for future reference, but I can't remember what the actual instance of it was...)
