#1 2009-08-04 05:42

prologician
Member
Registered: 2009-01-30
Posts: 84

PascalScript: Creating Classes?

Alright, here's one that's been floating around in my head for a while...

On the official PascalScript pages at RemObjects, they have (as far as I could see) two brief articles showing off some of PascalScripts abilities. According to the second of these articles, it seems like it ~should~ be able to handle the creation of user-created classes and objects. I'm having trouble getting this working, though... I keep seeming to generate errors.

Could someone potentially enlighten me as to what I'm doing wrong with this simple example?

type
  THelloWorld = class
    procedure Put;
  end;
 
procedure THelloWorld.Put;
begin
  ShowMessage('Hello, World!');
end;
 
var
  HelloWorld: THelloWorld;

begin
  HelloWorld := THelloWorld.Create;
  HelloWorld.Put;
  HelloWorld.Free;
end.

This code generates an "identifier expected" error on line 2... But alternately, if we change THelloWorld into an integer, and dump out the "THelloWorld.put" procedure, the error "Class type expected"... which seems like it ~should~ be able to handle classes somehow.

Offline

#2 2009-08-08 14:53

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,379

Re: PascalScript: Creating Classes?

Pascal Script can only import and use class definitions, but it cannot compile new classes. The article that you are probably referring to is: PS02 - Using Classes with RemObjects PascalScript - describes how to import and use classes.

On the good side, there isn't anything that can be done with classes and cant be done without them! wink

Offline

Board footer

Powered by FluxBB