comp.lang.ada
 help / color / mirror / Atom feed
From: Marin David Condic <nobody@noplace.com>
Subject: Re: Typing in Ada
Date: Wed, 02 Jun 2004 11:38:04 GMT
Date: 2004-06-02T11:38:04+00:00	[thread overview]
Message-ID: <40BDBBFA.2020203@noplace.com> (raw)
In-Reply-To: Xns94FC4607FBB23pchapinsovernet@207.106.92.237

You may be right about structs, but making the argument that because C 
can introduce a new type that it is therefore a strongly typed language 
doesn't seem to follow. Ada won't let you assign a character to an 
integer. C will. While a typedef example may not be 100% equivalent to 
an Ada type, that doesn't cause C to be strongly typed - which was the 
original point.

I'd also observe that just because there is a secret handshake that will 
get C to complain about type compatibility doesn't mean much. Following 
that logic, an assembler program can be made to complain about type 
compatibility (at least at runtime) if you want to do enough work. The 
problem is that typedef doesn't do what one who is acustomed to Ada 
would think it should: "type" - "def" - Define a type.

MDC


Peter C. Chapin wrote:
> 
> I guess my point was that in C typedef does not even attempt to define a 
> new type so comparing it to Ada's 'type' declaration seems unfair. For 
> example if you replace the type declarations in the OP's example with 
> unconstrained subtype declarations, the OP's Ada program compiles with no 
> complaints just like the the example C program using typedef does.
> 
> Now in C there *is* a mechanism for creating new types... it's just that 
> typedef isn't it. Thus it would be more appropriate to compare an Ada 
> program that introduces a new type that is a numeric range to a C program 
> that implements numeric ranges as structs. There is no doubt that the Ada 
> way of creating ranged types is easier and cleaner than any kind of 
> "equivalent" solution in plain C might be. On the other hand, I'm sure C++ 
> could do a much better job of emulating the Ada solution by using 
> templates and overloaded operators.
> 
> In any case, the OP's example didn't seem like a good example of how Ada 
> is more strongly typed than C. It is certainly true that Ada does not do 
> automatic type conversions the way C does, but the OP's example doesn't 
> illustrate that point. In contrast, when I think about a weakly typed 
> language I think about languages like AWK, the shell scripting languages, 
> or perhaps Perl... where the type of a variable shifts around depending on 
> how it is used. For example:
> 
> #!/bin/bash
> COUNT=1
> echo "COUNT is now $COUNT"   # Treat COUNT as a string
> COUNT=$(($COUNT + 1))        # Treat COUNT as a number
> echo "COUNT is now $COUNT"
> 
> Peter


-- 
======================================================================
Marin David Condic
I work for: http://www.belcan.com/
My project is: http://www.jsf.mil/NSFrames.htm

Send Replies To: m   o   d   c @ a   m   o   g
                    c   n   i       c   .   r

     "Face it ladies, its not the dress that makes you look fat.
     Its the FAT that makes you look fat."

         --  Al Bundy

======================================================================




  reply	other threads:[~2004-06-02 11:38 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-31 13:32 Typing in Ada Empit
2004-05-31 14:04 ` Poul-Erik Andreasen
2004-05-31 17:01 ` Jeffrey Carter
2004-05-31 20:03   ` Peter C. Chapin
2004-05-31 22:56     ` tmoran
2004-06-01  1:09       ` Peter C. Chapin
2004-06-01  4:40         ` tmoran
2004-06-01 11:26           ` Peter C. Chapin
2004-06-10  3:01             ` Dave Thompson
2004-06-10  3:00         ` Dave Thompson
2004-05-31 23:22     ` Nick Roberts
2004-06-01  1:04       ` Peter C. Chapin
2004-06-01  2:29         ` Nick Roberts
2004-06-02  4:39         ` Robert I. Eachus
2004-06-02 15:17           ` Hyman Rosen
2004-06-01  2:36       ` Hyman Rosen
2004-06-01  4:27         ` Larry Kilgallen
2004-06-01  4:05           ` Hyman Rosen
     [not found]         ` <d4vnb0tepd4togdrvdrbqpok1ne6n9i2vp@4ax.com>
2004-06-01 14:36           ` Wes Groleau
2004-06-01 20:24         ` Niklas Holsti
2004-06-02  4:43           ` Wes Groleau
2004-06-02  5:28             ` Robert I. Eachus
2004-06-02  8:19               ` tmoran
2004-06-02 14:47               ` Wes Groleau
2004-06-02 11:26             ` Marin David Condic
2004-06-02 14:54               ` gratuitous restrictions (was:Typing in Ada) Wes Groleau
2004-06-02  5:04           ` Typing in Ada Robert I. Eachus
2004-06-01  2:14     ` David C. Hoos
2004-06-02  1:30     ` Jeffrey Carter
2004-06-02 10:53       ` Peter C. Chapin
2004-06-02 11:38         ` Marin David Condic [this message]
2004-06-17  2:50           ` Dave Thompson
2004-06-17  4:24             ` James Rogers
2004-06-17 12:28               ` Hyman Rosen
2004-06-17 23:42                 ` James Rogers
2004-06-20 11:27                   ` Nick Roberts
2004-06-20 23:29                     ` new revision ada Brian May
2004-06-21  2:16                       ` tmoran
2004-06-21  2:34                         ` James Rogers
2004-06-22  2:16                           ` Roland Illig
2004-06-22  3:41                             ` James Rogers
2004-06-22  6:53                               ` Martin Krischik
2004-06-21 23:33                         ` Brian May
2004-06-22 20:26                           ` Simon Wright
2004-06-23  0:50                             ` Larry Elmore
2004-06-22 22:06                           ` tmoran
2004-06-21  5:31                       ` Wes Groleau
2004-06-21 12:27                       ` new revision ada (limited with, excpetion handling) Nick Roberts
2004-06-21 13:04                         ` Martin Dowie
2004-06-22 10:38                       ` new revision ada Georg Bauhaus
2004-06-22 12:45                         ` James Rogers
2004-06-22 15:17                           ` Martin Krischik
2004-06-22 16:09                             ` new revision ada (exception handling) Nick Roberts
2004-06-23  7:55                               ` Pascal Obry
2004-06-23  8:40                                 ` Martin Krischik
2004-06-23 19:33                                   ` Randy Brukardt
2004-06-24  6:57                                     ` Martin Krischik
2004-06-24 21:13                                       ` Randy Brukardt
2004-06-25  8:05                                         ` Dmitry A. Kazakov
2004-06-25 17:28                                           ` Randy Brukardt
2004-06-23  4:31                             ` new revision ada Brian May
2004-06-23 19:47                               ` Randy Brukardt
2004-06-22 16:37                           ` Georg Bauhaus
2004-06-26 14:57                           ` Robert I. Eachus
2004-06-01  1:02 ` Typing in Ada Alexander E. Kopilovich
  -- strict thread matches above, loose matches on Subject: below --
2004-06-01  2:11 David C. Hoos, Sr.
2004-06-01  2:13 David C. Hoos, Sr.
replies disabled

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