Re: SDL-News: Request for more flexible initialisation of array!


Subject: Re: SDL-News: Request for more flexible initialisation of array!
From: Rick Reed TSE (rickreed#tseng.co.uk)
Date: Sun Nov 30 1997 - 21:26:13 GMT


The originator of this message is responsible for its content.
-----From Rick Reed TSE <rickreed#tseng.co.uk> to sdlnews -----

At 14:10 +0000 28/11/97, dagbjorn#telox.no wrote:
>The originator of this message is responsible for its content.
>-----From dagbjorn#telox.no to sdlnews -----
>There is an annoying restriction wrt initialisation of arrays which
>I would like to see removed in SDL-2000. In current version of SDL,
>it is only possible to initialise all elements of an array to one and
>the same value. To initialise each element to a different value, a number
>of tasks must be specified which are executed in run-time. Cumbersome
>and expensive!
>
>If an array type is defined which may contain up to 12 integers, I
>would simply like to write:
>
>DCL daysOfMonth Int12ArrType := (. 31, 28, 31, 30, 31, 30, 31, 31, 30,
>31, 30, 31 .);
>
>or
>
>TASK daysOfMonth := (. 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 .);
>
>instead of 12 task statements like
>
>TASK daysOfMonth(1) := 31,
> daysOfMonth(2) := 28,
> ...
>
>It should be allowed to only initialise an array partly.
>
>-------------------------------------

Thank you for this contribution. The reason that such a construct was not
included earlier because the current data model requires all elements to
receive valid values. However, perhaps the new data model may not need this
restriction.

I forsee some issues that need to be addressed:

a) what if the index is large (or even uncountable - such as Integer)?

b) should "holes" be allowed in the array value?

c) the proposed syntax is probably syntactically ambiguous with the current
construct which will still be needed.

Effectively what you are proposing is another construct for an array value
(rather than a constant) so that in the example you give a valid value
would be:

(. 31, 28, daysOfMonth(1), 30, daysOfMonth(i), 30, 31, 31, 30, 31, 30, 31 .)

--
Rick Reed, TSE Limited
13 Weston House, 18-22 Church Street
Lutterworth Leicestershire LE17 4AW United Kingdom
Tel +44 14 55 55 96 55; Fax +44 14 55 55 96 58
email: rickreed#tseng.co.uk
http://www.tseng.co.uk   ftp://ftp.tseng.co.uk/tseng/

-----End text from Rick Reed TSE <rickreed#tseng.co.uk> to sdlnews ----- For help, email "majordomo#sdl-forum.org" with the body of your email as: help or (iff this does not answer your question) email: owner-sdlnews#sdl-forum.org



This archive was generated by hypermail 2a23 : Sun Jun 16 2013 - 10:41:40 GMT