comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: How to get nice with GNAT?
Date: Mon, 8 Dec 2014 16:45:51 -0600
Date: 2014-12-08T16:45:51-06:00	[thread overview]
Message-ID: <m659n0$utn$1@loke.gir.dk> (raw)
In-Reply-To: 1adpj5cs8xtkf$.hqv9tsofbfgz$.dlg@40tude.net

"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message 
news:1adpj5cs8xtkf$.hqv9tsofbfgz$.dlg@40tude.net...
> On Wed, 3 Dec 2014 15:41:12 -0600, Randy Brukardt wrote:
...
>> Huh? The thing passed is an access-to-a-symbol, which is an
>> access-to-variant-record in an untagged design, or an
>> access-to-class-wide-symbol in a tagged design.
>
> The subprogram you pass it should have been a primitive operation.

Not practical. I explained why later.

>> Either way, you'll get a run-time error.
>
> Yes, because it is weakly-typed. I would even dare put up a definition:
>
>   Typing is weak when type errors are run-time errors
>
>   (Untyped is when type errors are run-time bugs)

By this definition (which is not the typical definition of the phrase), any 
realistic program is weakly-typed.

>> In Ada 2012, you could use a predicate on the parameter in
>> order to make the check sooner, but it still will be a runtime check.
>
> And this still be weakly-typed, which is why dynamic predicates are so
> dangerous. They add nothing but another possibility for having a bug.
>
>> In may experience, most problems come down to managing combinations of
>> several kinds of objects (in the abstract sense, not the Ada sense), and
>> it's not sensible to try to do that in any sort of statically typed 
>> manner.
>
> Which is using Ada as if it were C. The combinations of objects should be
> handled in a way allowing to map combinations onto the language items
> allowing static checks. Yes, it is not always possible, and where not
> possible it becomes a C program in Ada, partially of course.

Not at all. C has no run-time checks; you'll never get any sort of error 
from it unless you write it explicitly yourself. I'm never going to have 
enough fortitude to write thousands of pages of checks by hand; I've got to 
have language support to make those checks.

In any case, your vision of strong typing (which is many times stronger than 
what I could stand) is completely impractical for me. I tried it in the Claw 
builder, and the result is very hard to extend. To add a new kind of window 
object, one has to write implementations for roughly 80 primitive 
subprograms; roughly 5000 lines of code. To add a new capability, one has to 
add implementations of new primitive operations to all of the existing kinds 
of window objects (around 20 at last count). Either of those takes multiple 
days of work before anything can be compiled. Since I'm "agile" to my core 
(and long before such a thing even had a name), spending more than 4 hours 
or so writing anything without a compile/run/test cycle is scary. Especially 
as I can't really remember what I did if it goes longer than that; debugging 
takes much longer if more code is involved. (In such a case, you have to 
re-remember what your plan was for particular problems -- it's much more 
like debugging existing code than something you just finished writing.)

Anyway, I think we just have to agree to disagree on this one.

My goal is to bring more static detection of what are formally run-time 
errors in Ada. I don't think calling that "typing" is helpful in any way, 
because the mechanisms are so different. YMMV.

                                              Randy.



  reply	other threads:[~2014-12-08 22:45 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-21 11:41 How to get nice with GNAT? Natasha Kerensikova
2014-11-21 12:42 ` Björn Lundin
2014-11-21 22:55 ` Randy Brukardt
2014-11-21 23:13   ` Björn Lundin
2014-11-22  9:45   ` How to get nice traceback " Natasha Kerensikova
2014-11-22  9:57     ` Dmitry A. Kazakov
2014-11-24 22:35     ` Randy Brukardt
2014-11-22 10:11 ` How to get nice " gautier_niouzes
2014-11-22 10:40   ` Natasha Kerensikova
2014-11-22 22:44 ` brbarkstrom
2014-11-22 23:24   ` Jeffrey Carter
2014-11-23 18:06   ` Björn Lundin
2014-11-23 16:13 ` brbarkstrom
2014-11-23 16:18   ` J-P. Rosen
2014-11-23 17:02   ` Jeffrey Carter
2014-11-23 17:41 ` brbarkstrom
2014-11-23 19:22   ` Simon Wright
2014-11-23 20:49   ` Jeffrey Carter
2014-11-24  3:05     ` brbarkstrom
2014-11-24  6:25       ` Jeffrey Carter
2014-11-24 14:39         ` brbarkstrom
2014-11-24 17:42       ` Dennis Lee Bieber
2014-11-25 13:45         ` brbarkstrom
2014-11-25 15:07           ` ake.ragnar.dahlgren
2014-11-25 15:51             ` brbarkstrom
2014-11-25 16:52             ` Jeffrey Carter
2014-11-25 19:18             ` G.B.
2014-11-25 20:47               ` brbarkstrom
2014-11-25 22:12             ` Randy Brukardt
2014-11-25 23:30               ` Simon Wright
2014-11-26  1:25                 ` G.B.
2014-11-26  7:35                   ` Simon Wright
2014-11-26 11:55                     ` Georg Bauhaus
2014-11-26 13:06                       ` Dmitry A. Kazakov
2014-11-26 13:36                         ` brbarkstrom
2014-11-26 21:27                         ` Randy Brukardt
2014-11-26 22:38                           ` brbarkstrom
2014-11-27  9:01                             ` Dmitry A. Kazakov
2014-11-27 13:53                               ` brbarkstrom
2014-11-27 17:19                                 ` Dmitry A. Kazakov
2014-12-01 22:25                                   ` Randy Brukardt
2014-12-02  8:42                                     ` Dmitry A. Kazakov
2014-12-03 21:41                                       ` Randy Brukardt
2014-12-06 12:02                                         ` Dmitry A. Kazakov
2014-12-08 22:45                                           ` Randy Brukardt [this message]
2014-12-09  8:51                                             ` Dmitry A. Kazakov
2014-12-09 23:14                                               ` Brad Moore
2014-12-09 17:59                                                 ` Dmitry A. Kazakov
2014-11-27  8:52                           ` Dmitry A. Kazakov
2014-11-26  6:18                 ` J-P. Rosen
2014-11-26  7:37                   ` Simon Wright
2014-11-26  8:41               ` Dmitry A. Kazakov
2014-11-25 18:33           ` Dennis Lee Bieber
2014-11-26  1:27             ` Dennis Lee Bieber
2014-11-26  3:29               ` brbarkstrom
2014-11-23 18:55 ` brbarkstrom
2014-11-23 19:30 ` brbarkstrom
2014-11-23 22:38   ` Simon Wright
2014-11-24  2:47     ` brbarkstrom
replies disabled

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