From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,f47e0c6e2e5fd00d X-Google-Attributes: gid103376,public From: "Matthew Heaney" Subject: Re: Function name problem Date: 2000/01/15 Message-ID: #1/1 X-Deja-AN: 573053986 Content-transfer-encoding: 8bit References: Content-Type: text/plain; charset="ISO-8859-1" X-ELN-Date: Sat Jan 15 10:46:45 2000 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.prod.itd.earthlink.net 947962005 38.26.192.198 (Sat, 15 Jan 2000 10:46:45 PST) Organization: EarthLink Network, Inc. Mime-version: 1.0 NNTP-Posting-Date: Sat, 15 Jan 2000 10:46:45 PST Newsgroups: comp.lang.ada Date: 2000-01-15T00:00:00+00:00 List-Id: In article , Harald Schmidt wrote: > I want to declare two function, but the 2nd is not > allowed by GNAT3.12. Could someone tell me why? > Here are the two declarations: > > package bla is > type Object is tagged limited private; > function "=" (Left, Right: in Object�Class) return Boolean; > function "==" (Left, Right: in Object�Class) return Boolean; > private > type Object is tagged limited null record; > end bla; There is no "==" operator in Ada. In Ada, "=" means "equality" (not assignment). If you want to override assignment for a type, you must declare the type as nonlimited and derive from Controlled: with Ada.Finalization; package P is type T is private; function "=" (L, R : T) return Boolean; -- equality private type T is new Ada.Finalization.Controlled with record ... end record; procedure Adjust (O : in out T); procedure Finalize (O : in out T); end P; You don't have the assignment operator for limited types. In that case, declare an explicity Copy operation. -- You cannot think without abstractions; accordingly, it is of the utmost importance to be vigilant in critically revising your modes of abstraction. It is here that philosophy finds its niche as essential to the healthy progress of society. It is the critic of abstractions. Alfred North Whitehead