🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.modula2
Article #1474

Oberon parameter passing

#1474
From: Corey Minyard
Date: Thu, 01 Oct 1992 20:34
29 lines
1418 bytes
I have a question about passing of array parameters in Oberon-2.
Lets say I want to write a procedure to print a string passed in to
it.  I would do something like:

        PROCEDURE PrintString(VAR s : ARRAY OF CHAR);
        BEGIN
           (* print string here *)
        END Print String.

But then the following would not work.

        PrintString("Hello");
        
Because a constant is being passed in.  So instead, the PrintString
routine would be:

        PROCEDURE PrintString(s : ARRAY OF CHAR);
        BEGIN
           (* print string here *)
        END Print String.

However; will "Hello" be copied onto the stack?  That seems very wasteful,
but I don't see any other way around it.  I am writing an Oberon-2
interpreter and I can't take this level of inefficiency.

----------------------------------------------------------------------
Corey Minyard
minyard@bnr.ca
Technical Details
Message-ID: <1992Oct01.203420.3612@bnr.ca>
Path: arc1-ca.pugleaf.net!sparky!uunet!pmafire!mica.inel.gov!ux1!news.byu.edu!gatech!darwin.sura.net!convex!news.utdallas.edu!corpgate!crchh327!crchh453!minyard

Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.modula2
Path: arc1-ca.pugleaf.net!sparky!uunet!pmafire!mica.inel.gov!ux1!news.byu.edu!gatech!darwin.sura.net!convex!news.utdallas.edu!corpgate!crchh327!crchh453!minyard
From: minyard@crchh453.bnr.ca (Corey Minyard)
Subject: Oberon parameter passing
Message-ID: <1992Oct01.203420.3612@bnr.ca>
Keywords: Oberon, parameter passing
Sender: news@bnr.ca (News on crchh327)
Nntp-Posting-Host: crchh453
Reply-To: minyard@bnr.ca
Organization: BNR
Date: Thu, 01 Oct 1992 20:34:20 GMT
Lines: 30