comp.lang.ada
 help / color / mirror / Atom feed
From: Robert Dewar <robert_dewar@my-deja.com>
Subject: Re: Built-in types (was Re: How can I avoid Using a Semaphore?
Date: Mon, 22 Jan 2001 17:20:49 GMT
Date: 2001-01-22T17:20:49+00:00	[thread overview]
Message-ID: <94hq56$rlv$1@nnrp1.deja.com> (raw)
In-Reply-To: 94hmgo$o2k$1@nnrp1.deja.com

In article <94hmgo$o2k$1@nnrp1.deja.com>,
  mark_lundquist@my-deja.com wrote:
> If that's my only
> requirement, then I'm being explicit about it when I write
> "Integer", because that's what Integer is supposed to be --
> the "whatever integer".

In this very unlikely scenario, I would suggest writing

  type My_Int is new Integer;
  --  Use standard default (and presumably efficient) integer

so that if there are porting problems, or if you do need to
specify additional attributes, then it is easily done without
major rewriting.

> (Let's see, just for integer types, what can the programmer
> specify? There's base range, size, alignment, stream I/O
> attributes... anything else?)

Yes, there are other things, but the point is that we are
specifically talking here about a complaint that you can NOT
specify them for the standard type Integer. That's what this
thread is about.

It is curious logic to be in a position of saying

1. I want to use Integer when I don't want to specify any
   additional stuff.

2. It is annoying that for type Integer, I cannot specify
   additional stuff

that makes little sense to me!


> Well that's just it... it seems like if the programmer is
> sharp enough to specify all this stuff, then he also ought to
> be sharp enough to know when he means the "whatever" types
> and to use them when that's what he means.

Please give a VERY clear example of why it is good EVER to
use type Integer (other than when constrained by a library)?

Even if efficiency is a concern, the proper approach is to
write something like

   type Temp_Int is range min-required .. max-required;
   type My_Int is new Temp_Int'Base;

Now use My_Int. That's really MUCH better than using Integer
directly.


> There was a thread here last year, in which someone was
> lamenting that Ada's integer types were not as "portable" as
> Java's because the language doesn't nail standardize the
> sizes/ranges.

Well this of course makes no sense. In Java you only have the
standard types, so it is important to standardize them. In
serious Ada, you don't use these standard types anyway, so
the fact that they are not defined is not relevant to serious
programs.

Of course at this stage, it would in practice be fine to define
type Integer as being always 32 bits, precisely because serious
code is not going to use this much anyway.

Well to be honest (as they say in the AARM), we can't do that
*because* of the involvement of Integer with Standard.String.


Sent via Deja.com
http://www.deja.com/



  reply	other threads:[~2001-01-22 17:20 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-01-13 16:18 How can I avoid Using a Semaphore? (long) DuckE
2001-01-15  1:06 ` How can I avoid Using a Semaphore? Nick Roberts
2001-01-15  3:17   ` Robert Dewar
2001-01-16  3:53   ` DuckE
2001-01-17 15:42     ` Nick Roberts
2001-01-20 18:16       ` DuckE
2001-01-20 19:16         ` Robert Dewar
2001-01-21  1:28           ` DuckE
2001-01-21 16:04             ` Robert Dewar
2001-01-21 23:23               ` DuckE
2001-01-22  0:28                 ` mark_lundquist
2001-01-22  1:51                 ` Robert Dewar
2001-01-23  2:36                   ` DuckE
2001-01-22  0:35               ` Built-in types (was " mark_lundquist
2001-01-22  1:54                 ` Robert Dewar
2001-01-22 16:18                   ` mark_lundquist
2001-01-22 17:20                     ` Robert Dewar [this message]
2001-01-22 23:17                       ` Mark Lundquist
     [not found]                         ` <m33deaaeks.fsf@ns40.infomatch.bc.ca>
2001-02-02 22:01                           ` Mark Lundquist
     [not found]                         ` <94km00$bv8$1@nnrp1.deja.com>
2001-02-02 22:03                           ` Mark Lundquist
2001-01-21 16:53           ` Nick Roberts
2001-01-21 18:24             ` Robert Dewar
2001-01-23  0:21               ` Nick Roberts
2001-01-22  0:16         ` mark_lundquist
2001-01-22 16:51 ` How can I avoid Using a Semaphore? (long) mark_lundquist
2001-01-23  6:02   ` DuckE
2001-02-02 22:00     ` Sucking (was Re: How can I avoid Using a Semaphore? (long)) Mark Lundquist
2001-02-03  1:44       ` Jeffrey Carter
2001-02-03  3:21       ` DuckE
2001-02-05 20:07         ` Mark Lundquist
2001-02-06  7:16           ` Sven Nilsson
2001-02-02 22:18     ` How can I avoid Using a Semaphore? (long) Mark Lundquist
2001-02-03  3:01       ` DuckE
2001-02-02 21:38 ` Niklas Holsti
replies disabled

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