zippoxer Posted November 3, 2011 Share Posted November 3, 2011 (edited) I know of the type TForm in SCAR that has methods, so I thought maybe we can do something like this in SCAR 3.28. The difference is minimal (writing item.Move instead of Move(item)), but if there is a syntax that a language recommends more than it's alternatives then I prefer to use it. Edited November 3, 2011 by zippoxer Quote Link to comment Share on other sites More sharing options...
KingKong Posted November 3, 2011 Share Posted November 3, 2011 I know of the type TForm in SCAR that has methods, so I thought maybe we can do something like this in SCAR 3.28.The difference is minimal (writing item.Move instead of Move(item)), but if there is a syntax that a language recommends more than it's alternatives then I prefer to use it. You are referring to classes, which SCAR Divi doesn't support yet(Titan does). But basically item.Move means call the Move procedure on an instance of the class called item(do i make sense?) Quote Link to comment Share on other sites More sharing options...
FHannes Posted November 3, 2011 Share Posted November 3, 2011 It's not a matter of just adding this. The script engine in SCAR Divi simply does not support user-defined classes. Only ones exported to the engine like TForm. You can however define method pointer type fields in records, but they will not be able to directly influence the data of the record. Support for all fo this is added in SCAR 4. Quote Link to comment Share on other sites More sharing options...
zippoxer Posted November 4, 2011 Author Share Posted November 4, 2011 You are referring to classes, which SCAR Divi doesn't support yet(Titan does). But basically item.Move means call the Move procedure on an instance of the class called item(do i make sense?) It means that item will be passed (in some way) to Move procedure, but the Move procedure is not global in that case, it's only callable through an instance of Item. Quote Link to comment Share on other sites More sharing options...
ti.teg.tnod.I Posted November 5, 2011 Share Posted November 5, 2011 It means that item will be passed (in some way) to Move procedure, but the Move procedure is not global in that case, it's only callable through an instance of Item. I'm a little late to the show ... but something like this? program New; type foo = record bar: procedure(test: String); end; var oof: foo; procedure rab(test: String); begin WriteLn(test); end; begin oof.bar := @rab; oof.bar('Hello World'); end. I don't think you're getting much closer than that though ... Quote Link to comment Share on other sites More sharing options...
FHannes Posted November 5, 2011 Share Posted November 5, 2011 I'm a little late to the show ... but something like this? I don't think you're getting much closer than that though ... As I said, you can use procedure pointers, but you can't access the fields of the records from those procedures, so it's pointless... Quote Link to comment Share on other sites More sharing options...
ti.teg.tnod.I Posted November 5, 2011 Share Posted November 5, 2011 As I said, you can use procedure pointers, but you can't access the fields of the records from those procedures, so it's pointless... I know it's pointless I was just hoping that would make him happy . Quote Link to comment Share on other sites More sharing options...