[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
| [m2t-dev] Re: int and long | 
Laurent,
Skyping was nice (I got to understand many "how to"s :p) yet ... I 
forgot to ask about this particular issue : primitive types in the 
backend for Integer, Short, ... (actually working with OCL now, and they 
have Integers too).
Did you plan to have those primitive types reflected in the backend? I'm 
still available on Skype though only for chatting at the moment (I can 
ask for a room if you think this would be easier).
Okay, let me exlain again.
Yes, OCL has Integer, but no Long - there is exactly one type for 
numbers without a fraction part, right?  And these are currently 
represented as Long in the backend. So the OCL type "Integer" is 
represented by LongType. There should *never ever* be an instance of 
java.lang.Integer in the backend - they must be converted to Long, as 
for example the Java calling code does. Otherwise you run into all kinds 
of difficulties, as you found out.
That should settle the OCL compatibility part.
It would be something else altogether if you needed to *differentiate* 
between functions taking int and long parameters. So far I never came 
across a convincing use case for that, but if you have one, I will not 
be too difficult to convince ;-) --> What do you need the 
differentiation for?
Another somewhat related issue I stumbled upon today : you have defined 
many primitive operations within the syslib. Among those is the 
"operatorEquals" defined on Object parameters... What to do in a case 
such as "1 * 5 == 5"?
Multiplication will return a Double, 5 is obviously an Integer. 
<anydouble>.equals(<anyinteger>) _cannot_ return true, which is however 
the expected result. What is the expected way of handling such a case 
with the backend? Do we need to convert every parameter to the same type 
before calling operatorEquals?
The multiplication of two Long numbers returns a Long value. If your 
specific situation (or your language in general) needs to treat Long and 
Double as equal, feel free to map the "==" operator of your language to 
some other library function that performs the type casts as needed. But 
I view this as specific to your language - you can implement special 
behavior for it, but it will probably not go into the syslib 
implementations.
- Arno
--
Arno Haase
Langemarckstr. 16
53227 Bonn
Mobil: +49 160 98525085
Tel:   +49 228 9654443
Fax:   +49 228 9654448
Attachment:
signature.asc
Description: OpenPGP digital signature