[net.micro.mac] Rascal Q&A

maclab@reed.UUCP (Mac DLab) (02/20/86)

 Just recently, I received some questions about Rascal in the mail. 
For those of you interested in Rascal details, the responses (below)
may be of interest. 

Note:  I am involved in development and support of Rascal, so take
	everything I say with a grain of salt.



> #1 Does Rascal support any kind of breaking a big program into smaller 
> pieces, either at development time or at run time: seperate compilation, 
> chaining, overlays, includes of code anywhere in the source ...?

At development time, you have plenty of freedom in terms of breaking
up your programs into separate library modules, and compiling
the different pieces only when necessary.  Chaining (transferring 
control to another program) is very easy to do -- a built-in call
handles it.  Includes, per se, are not supported.  Uses statements
are supported -- they have a similar same function, except they
pull in information from already-compiled programs, and  the
external code is not brought in until link-time.  Overlays are
not yet supported, so programs are currently limited to 32K of code.  We
are, however, almost ready to start testing an overlay (segmentation)
system, so this will be available eventually.


> #2 What is approx the size of a stand alone Open Window Display "Hello 
> World" And Quit program ? And the compile time?

From the start of compilation to the end of execution of such a program
(that includes linking) takes about 10 seconds on my Hyperdrive, so 
probably about 15-20 seconds on a floppy system.  There are two types
of stand-alone application shells, so there are two answers to the
size question.  The first type of stand-alone application is an
exact duplication of the development system's execution environment,
with all of the amenities, and the size of a hello world application
comes out to about 19K.  The second type of application is a stripped
down execution environment, and a slightly different hello world program
for that environment comes out to about 4K.  Hello world sources for
the two applications are shown below:

---------------------------------

program hw;
(*  This needs the full execution environment, and its application
    comes out to about 19K. *)

link __IO :;

proc _Init();
{
  writestring("Hello World");
  reqhalt();
};

---------------------------------

program hw;
  (* This hello world program can be made into a 4K stand-alone application *)

link __NoSysCall, __EasyWind :;

proc _Init();
Var
  i: integer;
{
  initwinds();
  MakeWind(@i,"My Window");   (* have to create a window first *)
  writestring("Hello World");
  haltwinds();
  reqhalt();
};
 
---------------------------------


> #3 Do the applications written in Rascal live together with the Switcher 
> as far as Rascal's runtime is concerned?

Yes, Rascal and its applications run fine under the Switcher.

 
> #4 What about pointers, records, variant records? How is the heapmanagement 
> implemented (mark/release/dispose) ?

Pointers are used extensively in Rascal, as in C.  Records (ala Pascal), Unions
(ala C) and record variants (similar to Pascal's, but easier to use) are
supported.  There are no special built-ins for the heap management calls --
programmers wanting run-time memory are expected to use the heap calls
as described in Inside Macintosh.

 
> #5 Are nested declaration of subroutine's allowed? What scope/ lifetime/ 
> visibilty rules apply? Are there things like static variables?

Nested routine declarations are not allowed.  Scope/lifetime/visibility
rules are essentially the same as Pascal's.  Static variables are allowed
(although there is currently no simple way to initialize them), as are
register variables and external variables (resolved at Link time).
 

> #6 What are the mechanism for passing parameters? (value, referece) Can 
> you pass (a pointer to) a subroutine as a parameter?
 
Parameter passing is free and easy in Rascal -- parameter checking on
procedure and function calls is for size and number only:  no explicit
type checking is performed.  This makes for a less forgiving Compiler,
but gives you greater freedom in writing your programs.  Function and
procedure pointers may be passed to routines, and in fact you can
call a function or procedure via some variable value.


Scott Gillespie
Reed College

UUCP:
{decvax, ucbvax, pur-ee, uw-beaver, masscomp, cbosg, aat,
 mit-ems, psu-cs, uoregon, orstcs, ihnp4, uf-cgrl, ssc-vax}!tektronix 
								\
						                 +--!reed!maclab
{teneron, ogcvax, cadic, oresoft, grpwre,     	         	/
 	  harvard, psu-cs, omen, isonvax, nsc-pdc}-------------+