Login ProductsSalesSupportDownloadsAbout |
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 |
Michael Dreher | I've declared some classes in different units
type TCell = class public actor : TObject; map : TObject; end; TActor = class public cell : TCell; end; TMap = class end; and made a bug procedure Move(actor : TActor); var map : TMap; begin map := Map(actor.cell.map); // <<<---- here // shound be... map := TMap(actor.cell.map); and; 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. Michael Dreher Attachments: Example.zip |
Thu, Jul 27 2017 10:44 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Michael,
<< 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. Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Friday, September 13, 2024 at 03:42 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |