[comp.sys.atari.st] Flame on TDI Modula-2

CS117205@YUSOL.BITNET (04/29/87)

Date:     Wed, 29 Apr 87 13:17 EDT
From:     <CS117205@YUSOL.BITNET>
Subject:  Re: Flame on TDI Modula-2
To:       Info-Atari16@Score.Stanford.edu
X-Original-To:  Info-Atari16@Score.Stanford.edu, CS117205

From:   EDU%"c150-em%sim.Berkeley.EDU@BERKELEY.EDU" 25-APR-1987 04:28
To:     CS117205
Subj:   Re: Flame on TDI Modula-2!

Received: From UCBJADE(BSMTP) by YUSOL with RSCS id 2018
          for CS117205@YUSOL; Sat, 25 Apr 87 04:28 EDT
Return-Path: <c150-em%sim.Berkeley.EDU@BERKELEY.EDU>
Received: from ucbvax.berkeley.edu
        by jade.berkeley.edu (5.54 (CFC 4.22.3)/1.16.12)
        id AA22014; Fri, 24 Apr 87 23:48:45 PDT
Received: by ucbvax.Berkeley.EDU (5.57/1.23)
        id AA08235; Fri, 24 Apr 87 23:49:01 PDT
Received: by zen.berkeley.edu (5.50/5.17)
        id AA08756; Fri, 24 Apr 87 23:47:48 PST
Received: by ucbvax.Berkeley.EDU (5.57/1.23)
        id AA08221; Fri, 24 Apr 87 23:48:37 PDT
Received: by sim.Berkeley.EDU (5.57/1.16)
        id AA06055; Fri, 24 Apr 87 23:48:14 PST
Date: Fri, 24 Apr 87 23:48:14 PST
From: c150-em%sim.Berkeley.EDU@BERKELEY.EDU (Class Account)
Message-Id: <8704250748.AA06055@sim.Berkeley.EDU>
To: zen!YUSOL.BITNET!CS117205
Subject: Re: Flame on TDI Modula-2!
Newsgroups: comp.sys.atari.st
In-Reply-To: <8704250326.AA03572@ucbvax.Berkeley.EDU>
Organization: University of California, Berkeley
Cc:

In article <8704250326.AA03572@ucbvax.Berkeley.EDU> you write:
>Date:     Fri, 24 Apr 87 23:23 EDT
>From:     <CS117205@YUSOL.BITNET>
>Subject:  Flame on TDI Modula-2!
>To:       Info-Atari16@Score.Stanford.edu
>X-Original-To:  Info-Atari16@Score.Stanford.edu, CS117205
>
>
>
>        The first has to do with the data types which you are permitted to
>use with procedure functions (M-2's equivalent of a Pascal function).  I
>have a set of procedure functions which return vector records (specifically
>state information data structures).  Well, I stick my definition module
>which contained the aforementioned procedure functions, through the compiler,
>and guess what I get?  A lovely little error 88 in those procedure functions.
>I look up in the manual and it says that an error 88 is "function type is
>not scalar or basic type".  Why does TDI assume that I will never need to pass
>a descriptor between modules?  That really infuriates me, especially after
>what I spent for the original version and then the second upgrade.
        This is not a bug.  Wirth's "Programming in Modula-2 (3rd edition)"
says on p.56 "The result of a function procedure cannot be structured."
TDI is merely following the Wirth Modula-2 standard.  If you need a
structured type returned, you must make it a variable parameter of a
procedure and return the value that way.
>        The other thing is sets.  Why does Modula-2, limit me to only 128
>elements in a large set?  What if I was creating some routines which
>required set elements greater than that number (for example the ASCII
>character set)?
        In the same book, p.150, Wirth says a set may have "at most N values,
where N is a small constant determined by the implementation, usually the
computer's wordsize or a small multiple thereof."  By giving you a limit of
eight times the Atari's wordsized, TDI is being generous.  Besides, the ASCII
character set only has 128 members, which is probably why TDI chose this
number.  So you see, neither one of these problems are bugs, but rather TDI
sticking to the Wirth standard for Modula-2.
                                        Best of luck
                                          Matthew Seitz

ZEIL@cs.umass.EDU (05/09/87)

> I have a set of procedure functions which return vector records (specifically
> state information data structures).  Well, I stick my definition module
> which contained the aforementioned procedure functions, through the compiler,
> and guess what I get?  A lovely little error 88 in those procedure functions.

Don't blame TDI - that's "standard" MODULA-2. In "Programming in Modula-2",
3rd edition, Wirth says "Only one value, however, can be returned as the
result of a function. This value, moreover, cannot be of a structured type."
The reasons for this have to do with the ease of implementation on a wide
variety of machines, but I agree that it's annoying. You either have to
use non-function procedures or else dynamically allocate the structured
value and return a pointer to it.


> The other thing is sets. Why does Modula-2, limit me to only 128 elements in
> a large set? What if I was creating some routines which required set
> elements greater than that number (for example the ASCII character set)?

My copy of the TDI manual indicates that the limit is 128 BYTES, not 128
elements, so you should be able to have sets of up to 8*128 elements. I
haven't tried this with version 2.0, but it works fine with version 3.0.

BTW, I've found upgrading to version 3.0 well worth the $60 charge. The
compiler is noticably faster and the code generated is much smaller.
The limitation on passing dynamic arrays as value parameters has been
lifted. There is a bug in the linker, as some folks have pointed out here
previously. Unlike the folks who complained about it earlier, I've been able
to compile all of the demos supplied with the commercial version without
incident. The bug appears to be related to the linker's running out of
storage. The one time it manifested itself, I was able to get rid of it by
dropping some extraneous IMPORTs left over from earlier debugging. I found
that I could also get rid of it by shrinking my ramdisk instead. (I run a
512k ETERNAL2 ramdisk on my 1040, which is enough to hold all of the
SYM and LNK libraries, the editor, linker, compiler, and m2desk, and still
has enough room for the temporary files generated by the compiler.)


                                                    Steve Z