Thread View: comp.lang.modula2
2 messages
2 total messages
Started by Robert L. Chase
Sun, 13 Sep 1987 01:41
procedure parameters and TRANSFER
Author: Robert L. Chase
Date: Sun, 13 Sep 1987 01:41
Date: Sun, 13 Sep 1987 01:41
30 lines
1783 bytes
1783 bytes
In setting up coroutines in Modula2, the NEWPROCESS procedure requires that the PROC (coroutine) be a parameterless procedure. Can anyone assist me with why that is the case? What is the underlying mechanism that requires this? I ask, since in my sabbatical work (beginnings of OS research) Bob Cook at UVA sets up coroutines etc as procedures that have one integer parameter, then doesn't use NEWPROCESS and TRANSFER, instead (since we were on Liliths at Virginia), using some of the procedures and CODE procedures that Wirth published. I need to implement same OS, and want to do it on a MAC (MAC II) and thus need to do some assembly lang stuff to do a NEWPROCESS and TRANSFER (or do I?). Any assistance would be appreciated. ~ ~/sign ---- Robert L. Chase INTERNET: rlc@uvacs.cs.virginia.edu Director of Academic Computing Computer Center Sweet Briar College UUCP: ...!mcnc!uvacs!rlc PO BOX AK ...!cbosgd!uvacs!rlc Sweet Briar, VA 24595 (804) 381-6232 ~p A -- Robert L. Chase, PO Box AK, Sweet Briar College, Sweet Briar, VA 24595 INTERNET: rlc@uvacs.cs.virginia.edu UUCP: ...!mcnc!uvacs!rlc or ...!cbosgd!uvacs!rlc
Re: procedure parameters and TRANSFER
Author: Alan Lovejoy
Date: Tue, 15 Sep 1987 20:55
Date: Tue, 15 Sep 1987 20:55
32 lines
2237 bytes
2237 bytes
In article <1966@uvacs.CS.VIRGINIA.EDU> rlc@uvacs.CS.VIRGINIA.EDU (Robert L. Chase) writes: >In setting up coroutines in Modula2, the NEWPROCESS procedure >requires that the PROC (coroutine) be a parameterless procedure. >Can anyone assist me with why that is the case? What is the >underlying mechanism that requires this? The underlying mechanism that "requires this" is that a well-designed language avoids complicating the life of a certain language and/or compiler designer named Niklaus Wirth. Specifically, the NEWPROCESS pseudo-procedure has the formal header definition: PROCEDURE NEWPROCESS(p: PROC; workArea: ADDRESS; workAreaSize: CARDINAL; process: ADDRESS); and a parameter of type PROC has to be a parameterless procedure. The language has no facility for specifying a procedure with a generic argument profile, and to make a special case for NEWPROCESS means more work for Niklaus Wirth as well as introducing an irregularity. Personally, I think the NEWPROCESS procedure *should* be a special case which allows procedures of any type, but its not my language. An even better solution would be to change the semantics of NEWPROCESS so that the PROCEDURE (MODULE) that invokes NEWPROCESS is the one that gets instantiated as a process. The formal definition would then be: PROCEDURE NEWPROCESS(workArea: ADDRESS; size: CARDINAL; VAR process: ADDRESS). This makes it unnecessary to specify the source-proc, since it is now known to be the caller. Lacking such changes to the syntax of Modula-2, the simplest and least elegant fix is to "pass" parameters via global variables. Ugh. --alan@pdn
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads