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-7-bit X-Google-Thread: 103376,9fb64e4c58f1fe X-Google-Attributes: gid103376,public From: dewar@cs.nyu.edu (Robert Dewar) Subject: Re: overload ":=" ??? Date: 1996/07/18 Message-ID: #1/1 X-Deja-AN: 168943707 references: <31ED3F5F.1135B4EA@jinx.sckans.edu> <4smd11$5bl@newsbf02.news.aol.com> organization: Courant Institute of Mathematical Sciences newsgroups: comp.lang.ada Date: 1996-07-18T00:00:00+00:00 List-Id: John Herro, answering a question from David said ">Is there a way to overload the assignment operator ":=" ? Unfortunately, no. However, you can write your own procedure Assign or Set. The difficulty with that is that you may forget to call it, and use the predefined := instead. The workaround is to make the type of the object you're assigning limited private. Then the compiler will force you to call your Set procedure, and won't allow you accidentally to use := (outside the package)." This seems the wrong advice. In Ada 95, nearly all cases where you want to redefine assignment can be nicely handled by using non-limited controlled types and redefining Adjust appropriately. I am not clear as to why John omitted this most obvious response. Perhaps he was answering in the framework of Ada 83 (where controlled types are not available).