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=0.7 required=5.0 tests=BAYES_00,INVALID_DATE, MSGID_SHORT,REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!pt.cs.cmu.edu!sei!firth From: firth@sei.cmu.edu (Robert Firth) Newsgroups: comp.lang.ada Subject: Re: Initialization Message-ID: <7540@fy.sei.cmu.edu> Date: 14 Jun 90 17:38:46 GMT References: <1957@sparko.gwu.edu> Reply-To: firth@sei.cmu.edu (Robert Firth) Organization: Software Engineering Institute, Pittsburgh, PA List-Id: In article <1957@sparko.gwu.edu> mfeldman@seas.gwu.edu (Michael Feldman) writes: >I have a rationale-type questions regarding an apparent irregularity >in Ada, namely in the area of default initializations. There is no good reason for the irregularity. Since a record component can be of any type, the implementation of record Component : Thing := Initial_Value; end record; is no more and no less difficult than the implementation of type Thing is Type_Definition := Initial_Value; would be. There are no serious parsing difficulties with the above syntax, and no additional semantic issues. The reason for the irregularity is historical. In the original Green language, the syntax of a record type definition read record_type_definition ::= RECORD component_list END RECORD component_list ::= {object_declaration} [variant_part] | NULL ; Because the syntax of object_definition was reused, the ability to initialise the component got carried over automatically. When this was noticed, it was decided that this was a useful thing to have. I recall asking Jean why he didn't make the type model more regular by allowing all types to have initialisation expressions, and his reply was that you could always achieve this effect by nesting the type you wanted in a record, and he didn't want to add extra syntax. Please do not ask me to defend this position.