|Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread|
|Messages 1 to 2 of 2 total|
|Wrong casting not rejected by the compiler|
|Thu, Jul 27 2017 5:26 AM||Permanent Link|
I've declared some classes in different units
TCell = class public
actor : TObject;
map : TObject;
TActor = class public
cell : TCell;
TMap = class end;
and made a bug
procedure Move(actor : TActor);
var map : TMap;
map := Map(actor.cell.map); // <<<---- here
// shound be...
map := TMap(actor.cell.map);
It compiles but of course the output isn't something usefull.
// function main_move(actor)
// var map;
// map = map; // <<<---- here
// map = actor.cell.map;
It would be nice if the compiler report an error. Example code in the attachment.
Is there something special about the name "map"? It's syntax highlighted like a keyword.
|Thu, Jul 27 2017 10:44 AM||Permanent Link|
Tim Young [Elevate Software]
Elevate Software, Inc.
<< It would be nice if the compiler report an error. Example code in the attachment. >>
Thanks, I'll check it out. I've got everything disassembled right now, but I'm doing a new build early next week.
<< Is there something special about the name "map"? It's syntax highlighted like a keyword. >>
Yeah, it was originally supposed to be used for "property expressions" and I never got around to implementing them. Property expressions are just a shortcut to avoid having to add property getters/setters that simply reference a property in a class instance that is a member variable of the current class. They basically save the overhead of a function call and allow the compiler to in-line such references.
This web page was last updated on
Wednesday, March 29, 2023 at 12:35 AM
© 2023 Elevate Software, Inc. All Rights Reserved
Questions or comments ? E-mail us at firstname.lastname@example.org