comp.lang.ada
 help / color / mirror / Atom feed
* Help withing Operators
@ 1999-11-18  0:00 Hovers
  1999-11-18  0:00 ` Gautier de Montmollin
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Hovers @ 1999-11-18  0:00 UTC (permalink / raw)


I want to find out how you overide a large number of operators.  I know you
can overwrite them one at a time, but if all the operators are contained
within a package, can you, in some way with that package's operators?


Using ADA95

Appreciate any help






^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Help withing Operators
  1999-11-18  0:00 Help withing Operators Hovers
  1999-11-18  0:00 ` Gautier de Montmollin
  1999-11-18  0:00 ` Matthew Heaney
@ 1999-11-18  0:00 ` Wes Groleau
  2 siblings, 0 replies; 4+ messages in thread
From: Wes Groleau @ 1999-11-18  0:00 UTC (permalink / raw)


Hovers wrote:
> 
> I want to find out how you overide a large number of operators.  I know you
> can overwrite them one at a time, but if all the operators are contained
> within a package, can you, in some way with that package's operators?
> 
> Using ADA95
> 
> Appreciate any help


IF you mean what I think you mean,


with Matrix_Package;
procedure Demo is

   Sample_1 : constant Matrix_Package.Matrix :=
             Matrix_Package.Random_Square_Matrix (Size => 5);

   Sample_2 : constant Matrix_Package.Matrix :=
             Matrix_Package.Random_Square_Matrix (Size => 5);

   Result   : constant Matrix_Package.Matrix :=
                Sample_1 * Sample_2 + Sample_2 * Sample_1;
                -- illegal; "+" and "*" are not visible

   use type Matrix_Package.Matrix;
   -- after this, it's legal.  I'd give you the RM paragraph numbers,
   -- but I'm just too blame lazy.




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Help withing Operators
  1999-11-18  0:00 Help withing Operators Hovers
@ 1999-11-18  0:00 ` Gautier de Montmollin
  1999-11-18  0:00 ` Matthew Heaney
  1999-11-18  0:00 ` Wes Groleau
  2 siblings, 0 replies; 4+ messages in thread
From: Gautier de Montmollin @ 1999-11-18  0:00 UTC (permalink / raw)


> I want to find out how you overide a large number of operators.  I know you
> can overwrite them one at a time, but if all the operators are contained
> within a package, can you, in some way with that package's operators?

Imagine you want to switch between classical integers and multi-precision
integers defined in a package with operators.
The with+use clause for this package will make all the operators defined there
available. Then, you define your type

  subtype myint is integer

or 

  subtype myint is multi_int

to use the type (and associated operators) you want. That's it...

-- 
Gautier

_____\\________________\_______\
http://members.xoom.com/gdemont/




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Help withing Operators
  1999-11-18  0:00 Help withing Operators Hovers
  1999-11-18  0:00 ` Gautier de Montmollin
@ 1999-11-18  0:00 ` Matthew Heaney
  1999-11-18  0:00 ` Wes Groleau
  2 siblings, 0 replies; 4+ messages in thread
From: Matthew Heaney @ 1999-11-18  0:00 UTC (permalink / raw)


In article <810os4$lko$1@trog.dera.gov.uk> , "Hovers" 
<hovers@dera.gov.uk> wrote:

> I want to find out how you overide a large number of operators.

Be more specific about what you're trying to do.  Give a *small* but
complete set of code.

Do you want to "override" operators of a type?  Or keep the operators,
but make them directly visible at their point of use?

Do you want to override the operators of a tagged type or nontagged
type?

Do you want to override only the "operatORS," or do you mean all the
"operatIONS" of the type?


> I know you
> can overwrite them one at a time, but if all the operators are contained
> within a package, can you, in some way with that package's operators?

You can get direct visibility to the operators by using a "use type"
clause, or by renaming just the ones you're interested in.

But you said override, so I'm not sure "use type" is what you want.

BTW: why do you want to override the operators of a type?

--
I see no good reasons why the views given in this volume should shock
the religious feelings of anyone.

Charles Darwin, The Origin of Species




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1999-11-18  0:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-11-18  0:00 Help withing Operators Hovers
1999-11-18  0:00 ` Gautier de Montmollin
1999-11-18  0:00 ` Matthew Heaney
1999-11-18  0:00 ` Wes Groleau

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