Subj : Re: curve for verbosity in a language To : comp.programming From : jimmaureenrogers@worldnet.att.net Date : Tue Aug 02 2005 06:43 pm pantagruel wrote: > A lot of languages can seem 'overly' verbose. If you worry that I might > be discussing your favorite language, I probably am. One thing I have > noticed is you never seem to have a language in which the simple > examples of programs in the language are very verbose but the verbosity > diminishes as one makes the program more complicated. > > Can anyone think of a language where verbosity in fundamentals of the > program leads to succinctness in the higher levels. > > of course verbosity is bound to be relative in nature. Ada is often accused of verbosity. There are some examples where an Ada program is much less verbose than the corresponding C program. The following example illustrates the point: with Ada.Text_Io; use Ada.Text_Io; with Ada.Calendar; use Ada.Calendar; procedure Task_Example is task type My_Tasks is entry Initialize(Num : in Positive); entry Report(Val : out Positive); end My_Tasks; task body My_Tasks is Local : Positive; begin accept Initialize(Num : in Positive) do Local := Num; end Initialize; Local := Local * 2; delay 1.0; accept Report(Val : out Positive) do Val := Local; end Report; end My_Tasks; Task_List : array(1..20) of My_Tasks; Cur_Val : Positive; Start_Time, End_Time : Time; begin Start_Time := Clock; for I in Task_List'range loop Task_List(I).Initialize(I); end loop; for I in Task_List'range loop Task_List(I).Report(Cur_Val); Put_Line("Task" & Positive'Image(I) & " :" & Positive'Image(Cur_Val)); end loop; End_Time := Clock; Put_line("Elapsed time:" & Duration'Image(End_Time - Start_Time)); end Task_Example; The output of this program is: Task 1 : 2 Task 2 : 4 Task 3 : 6 Task 4 : 8 Task 5 : 10 Task 6 : 12 Task 7 : 14 Task 8 : 16 Task 9 : 18 Task 10 : 20 Task 11 : 22 Task 12 : 24 Task 13 : 26 Task 14 : 28 Task 15 : 30 Task 16 : 32 Task 17 : 34 Task 18 : 36 Task 19 : 38 Task 20 : 40 Elapsed time: 1.005661055 This program defines a task type. Ada tasks provide concurrency similar to threads. Each task waits until it is initialized with an integer value. The value is doubled, then the task delays for 1.0 seconds. After the delay the task waits for its chance to report its value. Each task takes approximately 1 second to execute. The program then creates an array of 20 of those tasks. The entire 20 tasks take approximately 1 second to execute. Jim Rogers .