Re: SDL-News: Re: Casting from Duration to Integer.


Subject: Re: SDL-News: Re: Casting from Duration to Integer.
From: Rick Reed TSE (rickreed#tseng.co.uk)
Date: Fri Jul 16 2004 - 12:26:40 GMT


Become an SDL Forum Society member <http://www.sdl-forum.org/Society/members.htm>
The originator of this message is responsible for its content.
-----From Rick Reed TSE <rickreed#tseng.co.uk> to sdlnews -----

Milan Zoric at Milan.Zoric#etsi.org wrote on 15/07/04 09:25:

> Please note a comment/question below.
> - with strong typing, there is a need for casting because values of a
> given type need to be assigned to another type or need to be used in
> expressions

On further reflection Milan is correct. Conversions are sometimes needed to
be able to use operators/procedures defined on other types.

> - the tricks with fix and float operators work but the language
> definition should give the user a smarter way of achiving this

 ... which is what I proposed.

>> Probably the users wanted it so that they could write their
>> own encoding rules.
>
> [MZ] ?

... what is the question? Milan knows well that sometimes values are
converted in SDL from strong types or built-in types to Bitstring or
Octetstring values so that they can be passed over some interface that does
not support the application type. In my experience this is a common need for
conversions.

However, sometimes they are needed so that (for example) a value of type
ChargeUnits can be multiplied by a value of type Euros to produce a value of
type Euros. If this is to be written entirely in SDL, a conversion is
needed.

> [MZ] Encoding should be handled separately and casting should not be
> used for that.

At some point someone has to write the encoding/decoding algorithms and
these involve type conversions. If these algorithms are written in SDL then
'casting' is needed for this. If these are written in some other language,
or are considered as part of the language and tool, SDL does not need
'casting' for this purpose.

Anyway, we are agreed that such operators should be added to SDL.

--
Rick Reed - rickreed#tseng.co.uk
Tel:+44 15394 88462 Mob.:+44 7970 50 96 50

--End text from Rick Reed TSE <rickreed#tseng.co.uk> to sdlnews --- For extra SDL Forum Society benefits join at <http://www.sdl-forum.org/Society/members.htm>



This archive was generated by hypermail 2a23 : Thu May 09 2013 - 16:05:50 GMT