qore icon indicating copy to clipboard operation
qore copied to clipboard

Casts need to be implemented for basic built-in types

Open omusil24 opened this issue 7 years ago • 1 comments

%new-style
string a = cast<string>("test");

output:

omusil@giger:~$ qore test.q
unhandled QORE System exception thrown in TID 1 at 2017-08-29 15:49:54.464712 Tue +02:00 (CEST) at test.q:4
PARSE-EXCEPTION: reference to undefined class 'string'
chained exception:
unhandled QORE System exception thrown in TID 1 at 2017-08-29 15:49:54.464712 Tue +02:00 (CEST) at test.q:4
PARSE-EXCEPTION: cannot cast<> to type 'object'
chained exception:
unhandled QORE System exception thrown in TID 1 at 2017-08-29 15:49:54.464712 Tue +02:00 (CEST) at test.q:4
PARSE-TYPE-ERROR: lvalue for assignment operator '=' expects type 'string', but right-hand side is type 'object'

omusil24 avatar Aug 29 '17 13:08 omusil24

this is a "feature", not a bug, since it is a "design bug" and casts never worked for anything other than classes / objects until 0.8.13, and the new cast updates only added support for complex types - however it will be easy to implement

davidnich avatar Aug 31 '17 03:08 davidnich