comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Get_Line
Date: Fri, 1 Nov 2002 16:59:20 GMT
Date: 2002-11-01T16:59:20+00:00	[thread overview]
Message-ID: <wccy98d2plj.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: aps8gq$1qas$1@msunews.cl.msu.edu

"Chad R. Meiners" <crmeiners@hotmail.com> writes:

> "Robert A Duff" <bobduff@shell01.TheWorld.com> wrote in message
> news:wccd6prv3mk.fsf@shell01.TheWorld.com...
> > Why not, given that beginners have trouble with all that buffer
> > management?  In fact, so do experts!
> 
> I have never had trouble with Ada.Text_IO.  It was rarely the cause of
> confusion with students I tutored in an introductory programming course.

>...  Does Ada.Text_IO's design cause angst among the general
> Ada community?  I don't think so.

Well, maybe your students didn't have trouble.  Maybe that means you're
a good teacher.  But I know I've seen *many* questions about
Text_IO.Get_Line and related stuff on c.l.a. over the years.
And this stuff *ought* to be simple -- I'm not surprised when
a beginner is confused about discriminated tasks or something,
but when folks are confused about how to read in a line of text,
I think that indicates something wrong with the language.

> > By the way, if you're phobic of side effects, why do we have "X := new
> > T;" (in Ada) instead of "new(X);" (as a statement in Pascal)?
> 
> You do realize you are begging the question.  For instance, if you wanted to
> defame my character a little more, you could have written, "By the way, if
> you've finished beating your dog, why do we have ..."

Sorry, I didn't mean to defame your character.  I was just making an
analogy between side-effects in character-stream-reading functions,
and allocators, where for the latter we happily use function-call-like
notation.

> Do_Something (new T, new T, new T);
> 
> raises a mental alert, but
> 
> Do_Something (Get_Line, Get_Line, Get_Line);
> 
> does not.  The horrible tragedy is that the first example is more likely to
> not depend on the order in which the parameters are allocated while the
> second example will very likely carry some dependence on the order the
> functions are called.

OK, that convinces me that my analogy was poor.

Still, the reason "Do_Something (Get_Line, Get_Line, Get_Line);" is
wrong is that Ada does not define evaluation order.  The mere
*existence* of a Get_Line function should not cause people to write
that.

I actually think that Ada *should* define the evaluation order,
precisely because the above example can cause bugs.  Alternatively,
the language should forbid such examples at compile time, rather
than just giving wrong answers.  I realize that Ada has no mechanism for
having such compile-time checking, because the compiler doesn't know
which global variables a given function reads and writes.

- Bob



  reply	other threads:[~2002-11-01 16:59 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-29 20:24 Get_Line Justin Birtwell
2002-10-29 20:55 ` Get_Line David C. Hoos
2002-10-30  1:30 ` Get_Line Jeffrey Carter
2002-10-30 13:33   ` Get_Line Justin Birtwell
2002-10-30 14:40     ` Get_Line Preben Randhol
2002-10-30 17:09     ` Get_Line Jean-Pierre Rosen
2002-10-30 18:08     ` Get_Line Jeffrey Carter
2002-10-30 22:42       ` Get_Line Robert A Duff
2002-10-31  0:26         ` Get_Line Chad R. Meiners
2002-10-31  0:44           ` Get_Line Robert A Duff
2002-10-31 10:32             ` Get_Line John English
2002-10-31 11:30               ` Get_Line Preben Randhol
2002-10-31 13:10                 ` Get_Line John English
2002-10-31 17:39             ` Get_Line Warren W. Gay VE3WWG
2002-10-31 21:46             ` Get_Line Chad R. Meiners
2002-11-01 16:59               ` Robert A Duff [this message]
2002-11-01 21:04                 ` Get_Line Chad R. Meiners
2002-11-01 23:32                   ` Get_Line Matthew Heaney
2002-11-02  0:28                     ` Get_Line Chad R. Meiners
2002-10-31  8:53       ` Get_Line Preben Randhol
2002-10-31 18:04         ` Get_Line Jeffrey Carter
2002-11-01 11:18           ` Get_Line Preben Randhol
2002-10-30 14:44 ` Get_Line Preben Randhol
2002-10-31 21:55 ` Get_Line Matthew Heaney
  -- strict thread matches above, loose matches on Subject: below --
1999-07-02  0:00 GET LINE babefan
1999-07-02  0:00 ` czgrr
1998-06-05  0:00 get_line Steve Dyrdahl
1998-06-05  0:00 ` get_line Samuel Mize
1998-06-17  0:00   ` get_line Hans Marqvardsen
1998-06-18  0:00     ` get_line John McCabe
1998-06-21  0:00       ` get_line Robert Dewar
1998-06-06  0:00 ` get_line Dale Stanbrough
1998-06-06  0:00   ` get_line Robert Dewar
1998-06-06  0:00   ` get_line Matthew Heaney
1998-06-07  0:00     ` get_line Dale Stanbrough
1998-06-06  0:00       ` get_line Matthew Heaney
1998-06-18  0:00     ` get_line 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