home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!dtix!darwin.sura.net!Sirius.dfn.de!Urmel.Informatik.RWTH-Aachen.DE!vivaldi!pk
- From: pk@rwthi3.informatik.rwth-aachen.de (Peter Klein)
- Newsgroups: comp.lang.modula3
- Subject: Re: Constructors in Modula-3
- Message-ID: <1992Sep15.122237.271@Urmel.Informatik.RWTH-Aachen.DE>
- Date: 15 Sep 92 12:22:37 GMT
- References: <MHCOFFIN.92Sep14133341@tolstoy.uwaterloo.ca>
- Sender: news@Urmel.Informatik.RWTH-Aachen.DE (Newsfiles Owner)
- Reply-To: pk@rwthi3.informatik.rwth-aachen.de
- Organization: Lehrstuhl fuer Informatik III, RWTH Aachen, Germany
- Lines: 43
- Nntp-Posting-Host: vivaldi
-
- In article 92Sep14133341@tolstoy.uwaterloo.ca, mhcoffin@tolstoy.uwaterloo.ca (Michael Coffin) writes:
- >
- >I proposed what I think is a simple solution to this problem a couple
- >months ago, but got no response. My solution was to add a pragma, say
- ><*NO NEW*>, that can be affixed to type declarations in an interface.
- >E.g.,
- >
- > INTEFACE foo
- > <*NO NEW*> TYPE T <: U;
- > PROCEDURE New(x: INTEGER): T;
- > END foo.
- >
- >In the presence of this type declaration, NEW cannot be used to create
- >objects of type T. This forces the user of the interface to use
- >whatever constructor procedures are supplied in the interface; in this
- >case "New". (Of course, NEW could still be used inside a module that
- >implements foo.)
- >
- No, *please* no more pragmas. If you want to have a feature in the
- language standard, then introduce a new keyword. Everything else leads
- to portability problems. I see a certain use for pragmas if they don't
- change the semantics of a program, like <* OBSOLETE *> or <* INLINE *>.
- (What about INLINE anyway? Will it ever be supported?) But what you suggest
- definetely changes the semantics, and should therefore be a keyword (just
- like <* EXTERNAL *>, which is actually no pragma either).
-
- >What I would really like to see is a keywork, say PRIVATE, that does
- >what <*NO NEW*> does. I think it is a mistake in the language design
- >that Modula-3 tries to guess whether NEW should be allowed based on
- >how much is known about a type. Whether NEW is allowed is really
- >orthogonal to whether a type is completely opaque, partly revealed, or
- >fully revealed.
- >
- Yes. For constructors, this would be an acceptable solution.
-
- Peter
- ---
- Peter Klein E-Mail: pk@rwthi3.informatik.rwth-aachen.de
- Lehrstuhl fuer Informatik III Tel.: +49/241/80-21320
- Ahornstrasse 55 Fax.: +49/241/80-21329
- RWTH Aachen
- D-5100 Aachen
- Germany
-