comp.lang.ada
 help / color / mirror / Atom feed
From: chris.danx@ntlworld.com (Danx)
Subject: Re: Neat and tidy solution to following problem?
Date: 8 May 2002 01:16:41 -0700
Date: 2002-05-08T08:16:41+00:00	[thread overview]
Message-ID: <da2da981.0205080016.1e3cd433@posting.google.com> (raw)
In-Reply-To: 3CD87B38.D3DE1CC4@acm.org

Jeffrey Carter <jrcarter@acm.org> wrote in message news:<3CD87B38.D3DE1CC4@acm.org>...

> In Ada every type must be explicitly declared before it can be used.

The function would still have a "return type" explicitly given when
it's declared so that wouldn't be non-Adaish.  The explicitness I was
talking about was this

type some_record 
   is record
      the_word : word;
      remaining : some_string;
   end record;

function get_word (text : in some_string) 
   return some_record;

rather than

function get_word (text : in some_string)
   return (word, some_string);


it could be defined like this:

function get_word (text : in some_string)
   return (word, some_string) is
begin
   -- do somethis with the string, 
   -- finding w and str.

   return (w, str);
end get_word;

and used something like this:

...
(a, b) := get_word (temp);
...

> There are no exceptions to this rule. So it might be "neat" or "keen" or
> even easier to hack in Ada if this weren't the case, but that doesn't
> change Ada.

It was curiosity, not an attempt to make things easier to "hack".


Chris



  reply	other threads:[~2002-05-08  8:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-07 18:24 Neat and tidy solution to following problem? chris.danx
2002-05-07 19:17 ` Preben Randhol
2002-05-07 20:21   ` chris.danx
2002-05-08  1:11     ` Jeffrey Carter
2002-05-08  8:16       ` Danx [this message]
2002-05-07 20:38 ` achrist
2002-05-07 20:56   ` chris.danx
2002-05-25 20:56     ` Robert I. Eachus
replies disabled

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