Xref: utzoo comp.lang.modula2:3795 comp.lang.modula3:213 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!think.com!mintaka!bloom-beacon!eru!hagbard!sunic!mcsun!cernvax!chx400!chx400!bernina!neptune!inf.ethz.ch!brandis From: brandis@inf.ethz.ch (Marc Brandis) Newsgroups: comp.lang.modula2,comp.lang.modula3 Subject: Re: Two Oberon questions Message-ID: <28054@neptune.inf.ethz.ch> Date: 17 Apr 91 07:23:14 GMT References: <1991Apr12.104304.4194@jyu.fi> Sender: news@neptune.inf.ethz.ch Reply-To: brandis@inf.ethz.ch (Marc Brandis) Organization: Departement Informatik, ETH, Zurich Lines: 34 In article <1991Apr12.104304.4194@jyu.fi> sakkinen@jytko.jyu.fi (Markku Sakkinen) writes: >How is the type equivalence of two objects really defined in Oberon? >Modula-2 has "name equivalence", but Modula-3 has gone over to >structural equivalence (in my opinion: unfortunately). Oberon uses name equivalence as does Modula-2. There are two special cases in which structural equivalence is used: Open arrays and procedure variables. >Can function procedures in Oberon return structured values? No. There are good reasons not to allow this. It is rather complicated to implement and it is hard to find good examples where you need it. If you want to return a structured value, you would have to first assemble it into a local variable, which would then be copied to the final destination. In an efficient implementation, this would be an implicit VAR parameter. The common idea in Wirth's languages is not to hide what is going on, so in this respect it is better to declare the VAR parameter explicitly and to assemble the result directly into it. Note that you cannot use the result of such a function in an expression. All what you could do with it would be to assign it to another variable or to pass it to a procedure as a parameter. If you look at the intended programming style in Oberon, you will see that structure assignments and passing of structures as value-parameters occurs rarely. >Do different implementations of Oberon differ? The implementations of Oberon implemented at ETH do not. I cannot comment on other implementations, but I guess that the answer is also no. Marc-Michael Brandis Computer Systems Laboratory, ETH-Zentrum (Swiss Federal Institute of Technology) CH-8092 Zurich, Switzerland email: brandis@inf.ethz.ch