comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: MI is sloppy
Date: Thu, 11 Dec 2008 11:02:58 +0100
Date: 2008-12-11T11:02:58+01:00	[thread overview]
Message-ID: <1g29uf1ygl1wc$.1x184o2bk9m0k$.dlg@40tude.net> (raw)
In-Reply-To: ghpnj4$hce$1@munin.nbi.dk

On Wed, 10 Dec 2008 18:40:46 -0600, Randy Brukardt wrote:

> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message 
> news:d0goewygto13.10nsyzpabm3vn.dlg@40tude.net...
>> On Fri, 5 Dec 2008 19:42:40 -0600, Randy Brukardt wrote:
>>
>>> A waste of effort. I don't believe in multiple inheritance (in any form); 
>>> it seems to me to be an excuse for sloppy design.
>>
>> It is like saying that a record with two components is a sloppy design.
>> Either inheritance is a rubbish concept or else it is multiple.
>>
>> My pet example of MI is:
>>
>>   type In_File is ...;
>>   procedure Get (File : in out Input_File; Item : out Data);
>>
>>   type Out_File is ...;
>>   procedure Put (File : in out Output_File; Item : Data);
>>
>>   type Inout_File is .. ?
>>
>> Is it sloppy?
> 
> I tend to think so. These are insufficiently different to be types; there 
> should only be one type and different subtypes. Subtypes imply runtime 
> checks, but with good contracts most such errors can still be detected by 
> tools. And you don't have the goofy restrictions that come with trying to 
> make things separate types that aren't logically separate.

Huh, I don't see any difference. Semantically

   type Inout_File is ...
   procedure Get (File : in out Inout_File; Item : out Data);
   procedure Put (File : in out Inout_File; Item : Data);

   subtype In_File is ...;
   procedure Get (File : in out Input_File; Item : out Data) is abstract;

   subtype Out_File is ...;
   procedure Put (File : in out Output_File; Item : Data) is abstract;

Whatever way you go, incrementally adding operations or else incrementally
removing them.

But the second is certainly worse because it is statically uncheckable, it
is a "God-class," it is potentially inefficient when only input is used,
etc. (It is not the way programs are designed, if we could pick a ready
program from the pool of all possible programs. (:-))

> This is very much like the attempt to statically check accessibility 
> (lifetime) of objects. It doesn't work, at least not in general. And we have 
> much better technology in terms of detecting errors without goofy 
> restrictions than we did when these rules were defined, so why not use 
> them??

I just do not believe that. IF there is a tool capable to read my mind and
understand the program semantics and the reasonably warn me, THEN, please,
build it into the compiler and make those warnings errors. If there is
something (badly wrong) with that, then I don't need neither this tool nor
its features in the compiler.

Tools is cancer of compilers.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2008-12-11 10:02 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-06 10:09 MI is sloppy (was: Construction initialization problem) Dmitry A. Kazakov
2008-12-06 17:16 ` Georg Bauhaus
2008-12-06 21:16   ` Martin Krischik
2008-12-06 21:35     ` Maciej Sobczak
2008-12-07  9:12   ` MI is sloppy Dmitry A. Kazakov
2008-12-07 15:38     ` Georg Bauhaus
2008-12-07 20:04       ` Dmitry A. Kazakov
2008-12-11  0:40 ` MI is sloppy (was: Construction initialization problem) Randy Brukardt
2008-12-11 10:02   ` Dmitry A. Kazakov [this message]
2008-12-11 21:44     ` MI is sloppy Randy Brukardt
2008-12-11 23:17       ` Georg Bauhaus
2008-12-12 10:06         ` Dmitry A. Kazakov
2008-12-12  9:59       ` Dmitry A. Kazakov
2008-12-12 10:50         ` Georg Bauhaus
2008-12-12 11:15           ` Dmitry A. Kazakov
2008-12-12 12:15             ` Georg Bauhaus
2008-12-12 13:35               ` Dmitry A. Kazakov
2008-12-12 14:29                 ` Georg Bauhaus
2008-12-12 14:59                   ` Dmitry A. Kazakov
2008-12-13  0:08                 ` Randy Brukardt
2008-12-13  9:54                   ` Dmitry A. Kazakov
replies disabled

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