🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.modula2
Article #1957

Re: Two Oberon questions

#1957
From: Victor Sanchez
Date: Thu, 18 Apr 1991 19:31
31 lines
1799 bytes
>In article <1991Apr12.104304.4194@jyu.fi> sakkinen@jytko.jyu.fi (Markku Sakkinen) writes:
>
>>Can function procedures in Oberon return structured values?
>
No. But it is not needed (I think). Please somebody correct me if I am
wrong, but if you have automatic garbage collection you can use the
pointers to structures in a more flexible way. e.g. suppose we are
writing a set of function that perform operations on matrices. We 
define a structure called Matrix. We would like the functions to 
return a matrix structure so we can chain the operations:

a = MultMat(a,AddMat(b,c));

instead of 
AddMat(b,c,temp1);
MultMat(a,temp1,a);

This cannot be done if the functions deal with pointers to Matrices, 
because, for example the routine MultMat cannot DISPOSE(a) and then
assign it the new pointer to the structure. If garbage collection 
exists then we can happily change the place in memory pointer "a" is
pointing to, the garbage collector will realize that the old memory
pointed by "a" is not used anymore and make it available. So you
can now use pointers to structures complety to replace return structures,
perhaps one pays a price for that, but returning structures is not very
efficient anyways.

Is this correct? Or am I missunderstanding the way garbage collection
works?

			Victor Sanchez
Technical Details
Message-ID: <1991Apr18.193134.28552@casbah.acns.nwu.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!casbah.acns.nwu.edu!vsanchez
References: <1991Apr12.104304.4194@jyu.fi> <28054@neptune.inf.ethz.ch>

Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.modula2,comp.lang.modula3
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!casbah.acns.nwu.edu!vsanchez
From: vsanchez@casbah.acns.nwu.edu (Victor Sanchez)
Subject: Re: Two Oberon questions
Message-ID: <1991Apr18.193134.28552@casbah.acns.nwu.edu>
Organization: Northwestern University
References: <1991Apr12.104304.4194@jyu.fi> <28054@neptune.inf.ethz.ch>
Date: Thu, 18 Apr 1991 19:31:34 GMT
Lines: 33