comp.lang.ada
 help / color / mirror / Atom feed
* Re: "the so-called Beaujolais effect"
@ 1993-04-26 16:05 Tucker Taft
  0 siblings, 0 replies; 3+ messages in thread
From: Tucker Taft @ 1993-04-26 16:05 UTC (permalink / raw)


In article <1993Apr23.194731.24560@convex.com> sercely@convex.com (Ron Sercely)
 writes:

>What is this? I have been reading the "Intoducing Ada9X" Ada9X Project
>Report, and came across this term on p. 66.  Please excuse my ignorance
>if this is really well known.  If not, a lot of us letters will become
>a little less ignorant :-)

As a professor would say... "Good Question."

The term "Beaujolais effect" was coined during the original
Ada 83 design effort, when Jean Ichbiah promised a bottle
of Beaujolais to anyone who could find an instance of the following:

   If one adds or removes a declaration from a package,
   and that package is "use"d in some compilation unit,
   the compilation unit remains legal upon recompilation,
   but has a different meaning.

Generally, this doesn't happen in Ada 83 because of the
subtle rules for "use" visibility (RM 8.4(5,6)).  
However, there are some extremely subtle cases of
the Beaujolais effect that remain in Ada 83 that are 
related to the preference against implicit conversion (RM 4.6(15)).

Note that an equivalent statement of the Beaujolais
effect is that when adding or removing a single "use" clause 
a compilation unit remains legal but changes meaning.

We endeavored to avoid introducing new examples of "Beajolais"
effects during the 9X revision, and as part of revising
the rules on implicit conversion (as needed to support OOP)
we also eliminated the few remaining cases that were
present in Ada 83.

For those who care, here is an example of a Beaujolais
effect in Ada 83 (this comes from the "Ada 9X Compatibility
Guide" prepared by Bill Taylor of Transition Technology Limited):

    package P is
       procedure Q(B : Boolean);                 -- Q1
    end P;

    with P; use P;
    procedure Main is
       function "<"(X, Y : Integer) return Integer;
       procedure Q(I : Integer) is ... end Q;    -- Q2
    begin
       Q(1 < 2);   -- Interpreted as Q1 due to "use P;"
                   -- Would be interpreted as Q2 if Q1 deleted
                   -- from P, or "use P" clause removed.
    end Main;
 
In Ada 9X, the above compilation unit "Main" would
be considered ambiguous, because the preference rule
relating to use of integer literals is more locally
defined (see RM9X-8.6(29-30);2.0):

  There is a "preference" for the primitive operators
  of the root numeric types root_integer and root_real.  In particular,
  if two acceptable interpretations of a constituent of a complete 
  context differ only in that one is for a primitive operator of
  the type root_integer or root_real, and the other is not, the 
  interpretation using the primitive operator of the root
  numeric type is "preferred."

  For an innermost complete context, if there is exactly
  one overall acceptable interpretation where each constituent's
  interpretation is the same as or preffered (in the above sense)
  over those in all other overall acceptable interpretations, then
  that one overall acceptable interpretation is chosen.  Otherwise
  the complete context is "ambiguous."

"Q(1 < 2);" is ambiguous in Ada 9X because the interpretation of 
Q1(1 < 2) is *not* preferred over Q2(1 < 2) in Ada 9X, since the 
interpretations differ in more than just their interpretation 
of "<".  They also differ in their interpretation of "Q", which
is not a primitive operator of a root numeric type.

In Ada 83, Q(1 < 2) is not ambiguous, because the Q1 interpretation
does not require any implicit conversions of integer literals,
whereas the Q2 interpretation requires some implicit conversions.

As it turns out, this change should affect very few (if any) "real"
programs, since it only occurs in situations where
programmers override predefined operators with "weird"
result types.  And it only occurs when the "Beajolais" effect
was possible, so the affected programs (if any) were
potential maintenance time-bombs.

>Ron Sercely

S. Tucker Taft   stt@inmet.com
Ada 9X Mapping/Revision Team
Intermetrics, Inc.
Cambridge, MA  02138

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

* Re: "the so-called Beaujolais effect"
@ 1993-04-27 14:34 cis.ohio-state.edu!zaphod.mps.ohio-state.edu!howland.reston.ans.net!agate
  0 siblings, 0 replies; 3+ messages in thread
From: cis.ohio-state.edu!zaphod.mps.ohio-state.edu!howland.reston.ans.net!agate @ 1993-04-27 14:34 UTC (permalink / raw)


stt@spock.camb.inmet.com (Tucker Taft) writes:
: The term "Beaujolais effect" was coined during the original
: Ada 83 design effort, when Jean Ichbiah promised a bottle
: of Beaujolais to anyone who could find an instance of the following:
     ^^^^^^^^^^
So, was he trying to *discourage* people from finding any such instance?
(Sorry, couldn't resist ;-)
-- 
-------------------------------------------------------------------------------
John English                    | "There are basically two types of dicks,
Dept. of Computing              |  hard dicks and floppy dicks."
University of Brighton          |    -- from a student essay on storage media
E-mail: je@unix.brighton.ac.uk  | "Disks are divided into sex & tractors."
Fax:    0273 642405             |    -- from one of my lectures (on a bad day)
-------------------------------------------------------------------------------

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

* Re: "the so-called Beaujolais effect"
@ 1993-05-10 14:54 Mike Zwilling
  0 siblings, 0 replies; 3+ messages in thread
From: Mike Zwilling @ 1993-05-10 14:54 UTC (permalink / raw)


-- 
Mike Zwilling       University of Wisconsin-Madison              
Computer Sciences Dept.
1210 W. Dayton St.
Madison, WI  53706-1685  email: zwilling@cs.wisc.edu  ph# (608) 263-4076

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

end of thread, other threads:[~1993-05-10 14:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1993-04-27 14:34 "the so-called Beaujolais effect" cis.ohio-state.edu!zaphod.mps.ohio-state.edu!howland.reston.ans.net!agate
  -- strict thread matches above, loose matches on Subject: below --
1993-05-10 14:54 Mike Zwilling
1993-04-26 16:05 Tucker Taft

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