Page 1 of 1

Add '+0' is the shortest conversion among integer-like domains.

Posted: 22 Sep 2014 12:51
by Ferenc Nagy
The different integer-like subtypes in calling and called procedure result error message.

Code: Select all

domains sci_style = unsigned8 predicates deleteStyleByNum:(sci_style Number) determ. %------------------------------------ predicates     oneDeleteClick : button::clickResponder. clauses     oneDeleteClick(_Source) = button::defaultAction :-         Num=number_int:getInteger(),         def_style:deleteStyleByNum(Num).
The expression has type '::integer', which is incompatible with the type 'sciLexer_native::sci_style' Reporter.pro Enhanced_Report\
The simplest correction: Add zero to the integer variable in the calling statement.

Code: Select all

def_style:deleteStyleByNum(Num+0),                

Posted: 22 Sep 2014 13:16
by Thomas Linder Puls
I think this is a bad idea: The code lookes like a sum (even a silly sum), but it in fact a type conversion.

I think it is better to write code that reflects what it does (even if it is not written in the shortest possible way):

Code: Select all

clauses     oneDeleteClick(_Source) = button::defaultAction :-         Style = convert(sci_style, number_int:getInteger()),         def_style:deleteStyleByNum(Style).