comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@acm.org
Subject: Re: Making guarantees about record components
Date: Wed, 20 Nov 2013 20:58:09 +0000 (UTC)
Date: 2013-11-20T20:58:09+00:00	[thread overview]
Message-ID: <l6j7p1$433$1@speranza.aioe.org> (raw)
In-Reply-To: l6gqci$lrk$1@dont-email.me

> To really guarantee the property, you'd have to encapsulate M ...
  How many bugs have been caused by things like leaving out the first
line of
  Last := Last+1;
  Saved(Last) := New_Item;
(or misplacing the "++" in C code).
 The only way to ensure the abstraction of a data structure where Last
always points to the last item in Saved is by hiding it and
introducing an Append procedure.  For simple abstractions like this,
that's so heavy handed it's rarely done.  Predicates, as in the OP's
problem, are a very limited step toward eliminating this class of errors.

  parent reply	other threads:[~2013-11-20 20:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-19 18:49 Making guarantees about record components J Kimball
2013-11-19 20:20 ` Anh Vo
2013-11-19 22:57 ` Jeffrey Carter
2013-11-20  9:36   ` Stephen Leake
2013-11-20 17:37     ` Jeffrey Carter
2013-11-21  6:53       ` Stephen Leake
2013-11-20 20:58   ` tmoran [this message]
2013-11-19 23:38 ` Shark8
2013-11-20  8:01   ` Dmitry A. Kazakov
2013-11-22  5:46 ` J Kimball
replies disabled

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