comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <see.reply.to@maps.futureapps.de>
Subject: Re: Problem using Ada.Text_IO.Modular_IO
Date: Fri, 11 Jul 2008 11:49:06 +0200
Date: 2008-07-11T11:49:07+02:00	[thread overview]
Message-ID: <48772c92$0$6601$9b4e6d93@newsspool2.arcor-online.net> (raw)
In-Reply-To: <qUxdk.110405$102.10780@bgtnsc05-news.ops.worldnet.att.net>

anon wrote:
> Why re-invent the Wheel!!! If we spend all day re-stating that which 
> has been done then nothing new get done that day! 


As Adam is pointing out below---in two paragraphs which I think
are really recommended reading---Unsigned_64 is defined for a
specific programming context. Typically that of interfacing
to 2**N bit addressable hardware, N >= 3.

When a program does not perform any interfacing, but still
uses types from Interfaces, then in a sense its use of type is
close to C's approach to the fundamental type system:
In C, you have fundamental "scalar" types that say,
"at least that many bits, some operations, some behavior at the
bounds, and please look up the rest in the compiler's
documentation".  When Ada allows the programmer to work at a
higher level of type isolation and expressiveness, without loosing
any performance, not having to consult compiler docs,
isn't this a win?

I recall a c.l.ada message from a university teacher of embedded
systems programming (model trains, I think) whose classes had
switched from C to Ada. After that, the students had achieved more
and got better results. The effect was attributed to Ada's
fundamental type system and types defined in terms of the
(abstracted) problem domain.  I.e., not just Interfaces.


> In <32e35e5a-3cae-4fdc-be4a-3ae1e146e9f3@l64g2000hse.googlegroups.com>, Adam Beneschan <adam@irvine.com> writes:

>> Of course, it really doesn't matter which one you use (except,
>> perhaps, to help prevent incorrect type conversions).  The only
>> differences have to do with readability, pedagogy, and helping make
>> your programs self-documenting.  But ever since Ada was designed, the
>> position of the Ada community has been that it's better to avoid using
>> the standard numeric types provided by Ada (Integer, Float) and define
>> your own that explicitly include the numeric range you need.  You seem
>> to be going in the opposite direction, by recommending that this user
>> use a standard type provided by the language rather than defining his
>> own (although the standard type you recommend is certainly better
>> defined than Integer or Float).
>>
>> Another issue is that an implementation doesn't have to provide
>> Interfaces.Unsigned_64.  It should be present on any target processor
>> whose addressable unit is an 8-bit byte or a 16-, 32-, or 64-bit
>> word.  But I've seen processors in the past that use 6-bit characters
>> or 36-bit words, and in those cases, using Unsigned_64 instead of "mod
>> 2**64" will turn a portable program into a nonportable one.  I'll
>> grant that such processors are rare these days.
>>
>>                                  -- Adam
>>
> 

--
Georg Bauhaus
Y A Time Drain http://www.9toX.de



  reply	other threads:[~2008-07-11  9:49 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-09 16:52 Problem using Ada.Text_IO.Modular_IO jujosei
2008-07-09 19:03 ` Anh Vo
2008-07-09 19:22   ` Adam Beneschan
2008-07-09 21:50 ` Adam Beneschan
2008-07-10 15:00   ` jujosei
2008-07-10  0:48 ` anon
2008-07-10  1:52   ` Adam Beneschan
2008-07-10  7:25     ` anon
2008-07-10 14:59       ` Adam Beneschan
2008-07-11  0:34         ` anon
2008-07-11  9:49           ` Georg Bauhaus [this message]
2008-07-11 10:05             ` christoph.grein
2008-07-11 13:21               ` John McCormick
2008-07-11 12:16             ` anon
2008-07-11 13:26               ` petter_fryklund
2008-07-11 21:10                 ` anon
2008-07-12 10:06                   ` Georg Bauhaus
2008-07-13  0:51                     ` anon
2008-07-13 16:03                     ` Georg Bauhaus
2008-07-14  2:03                       ` anon
2008-07-14 13:12                         ` Georg Bauhaus
2008-07-16  6:16                           ` micronian2
2008-07-16  7:47                             ` anon
2008-07-17 16:33                               ` micronian2
2008-07-14 16:34                       ` micronian2
2008-07-14 17:26                         ` Georg Bauhaus
2008-07-16  6:28                           ` micronian2
replies disabled

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