comp.lang.ada
 help / color / mirror / Atom feed
* Nested declares, constant size arrays and clarity
@ 2007-10-03 22:58 Mateusz Papiernik
  2007-10-03 23:49 ` Ludovic Brenta
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Mateusz Papiernik @ 2007-10-03 22:58 UTC (permalink / raw)


Hey!

I'm starting off with Ada95. I'm having some problems with clarity of my 
solution, which - I think - is not as good as I would like to.

I've got my root procedure in which I read some number from the standard 
input. Then I create an array of MyType with size read before.

procedure mxp is
   ... -- some record type declarations
   ... -- some *functions*
begin
   ... -- read size
   declare
     type MyTypeArray is array (1...sizegiven) of MyType;
     MyArray: MyTypeArray;
     ... -- some *functions* doing something with newly made array
   begin
     ... -- these function calls
   end;
end;

The problem is, I don't really like the idea of declaring some functions 
in the root procedure declaration, and some others in nested declare 
section. Due to that I've got function implementations in two places, 
which somehow feels awkward to me.

Is there any way to accomplish the same without that nesting _and_ 
without building external module/using OOP/pointers?

Maybe there is a way to define general array type of unknown size, then 
declare functions doing something with it in the topmost declaration 
section, and then only somehow initialise the array with given size?



Thanks for any advice!
-- 
Mateusz Papiernik, Maticomp Webdesign
Projektowanie i realizacja witryn WWW
mati@maticomp.net, http://www.maticomp.net
"One man can make a difference" - Wilton Knight



^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2007-10-05 17:08 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-03 22:58 Nested declares, constant size arrays and clarity Mateusz Papiernik
2007-10-03 23:49 ` Ludovic Brenta
2007-10-04  8:49   ` Mateusz Papiernik
2007-10-04 11:33     ` Ludovic Brenta
2007-10-04 12:45       ` Dmitry A. Kazakov
2007-10-04 13:11         ` Mateusz Papiernik
2007-10-05  5:00           ` Jeffrey R. Carter
2007-10-05  4:58         ` Jeffrey R. Carter
2007-10-05  7:38           ` Dmitry A. Kazakov
2007-10-05 17:08             ` Jeffrey R. Carter
2007-10-05  4:54     ` Jeffrey R. Carter
2007-10-04  0:20 ` Jeffrey R. Carter
2007-10-04  8:51   ` Mateusz Papiernik
2007-10-05  2:45     ` Steve Whalen
2007-10-04  0:23 ` anon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox