comp.lang.ada
 help / color / mirror / Atom feed
* Re:  Predefined Operations
@ 1986-10-08 19:08 BBardin
  0 siblings, 0 replies; 2+ messages in thread
From: BBardin @ 1986-10-08 19:08 UTC (permalink / raw)



If I may, a few more words on the issue of predefined operations,
specifically, where are they declared and when are they found in
STANDARD as opposed to 'somewhere else':

First, as Doug Bryan pointed out, there is a problem with the
semantics of the term 'predefined'.  One needs to distinguish between
predefined types and predefined operations.  When referring to types,
'predefined' implies a declaration (emphasis on 'declaration') which
has been made ahead of time, i.e., declared previously.  When refering
to operations, 'predefined' referes to a set of operations that will
be (emphasis on 'will be') declared (implicitly) at some point.
Predefined types are types which have actually been declared;
'predefined operations' refers to an a priori definition of a set, not
a pre-declaration of the actual operations.

Now, the rule for where the declarations for the set of predefined
operations for a given type are found is straight forward:

  "The operations implicitly declared for a given type declaration
   occur after the type declaration..." (ARM 3.3.3(2))

(The term 'implicitly declared' is used instead of 'predefined'
because there may be operations other than the predefined set which
are also implicitly declared (specifically, user defined operations
derived from a parent type)).

Thus, the location of the declaration of a predefined operator is
always known; it is found immediately after the type declaration for
which the operator applies.  If this type is found in 'Standard'
(e.g., 'Integer', 'Boolean', 'Character', 'String'), then the
declarations for the predefined operations are found in standard.  If
the type is found in the predefined package 'Calendar', (e.g.,
'Time'), then the declarations for the predefined operations are found
in 'Calendar'.  If the type is found in the user defined package
'Foo', then that is where the declarations for the predefined
operations are found. 


John Prentice, 
Hughes
-------

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

* predefined operations
@ 1986-10-09 18:11 Doug Bryan
  0 siblings, 0 replies; 2+ messages in thread
From: Doug Bryan @ 1986-10-09 18:11 UTC (permalink / raw)



Since we are still on the subject of predefined operations, I may as well
throw out the execption to the rule:

	procedure Not_Immediately_After is
	   type F1 is delta 1.0/16    range 0.0 .. 1_000.0;
	   type F2 is delta 2#0.1#E-3 range 0.0 .. 1_000.0;
	   X : F1 := 1.0;
	   Y : F2 := 2.0;
	begin
	   X := F1 (Standard."*"(X, Y));
	end Not_Immediately_After;

The reason this works is that any two fixed point operands may be multiplied.
Since the two fixed point types may be declared in different, non-overlapping
scopes, the only deterministic place to define "*" is in Standard.  The result
of this operation is of the type universal_fixed and is never implicitly
converted to a name type (like universal_integer and universal_real are).

doug
-------

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

end of thread, other threads:[~1986-10-09 18:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1986-10-09 18:11 predefined operations Doug Bryan
  -- strict thread matches above, loose matches on Subject: below --
1986-10-08 19:08 Predefined Operations BBardin

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