[comp.sys.mac.programmer] MPW Linker wish...

ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University) (12/12/90)

Wouldn't it be nice if the MPW Linker supported Modula-2 and like-minded
languages? Specifically, it should do the following:

* Automatically sort initialization code for modules into the right
  sequence, based on their import relationships (if A imports B
  which imports C, then C should initialize before B, which in turn
  should initialize before A).
* Check for and *disallow* circular imports (I don't care what
  Niklaus Wirth says, circular imports are wrong)--if A imports
  B which imports C which imports A, then this is an error.
  All right--it should at least be a warning.
* Support checking of compilation dates/times on modules, so that
  if A and B import C, the Linker can check that they import
  the same version of C (to ensure that both A and B are recompiled
  if the interface to C has changed).

I have seen at least one linker (the VAX/VMS one) that supported the last
feature. But the only one I've seen that catered to the first two
was part of a standalone Modula-2 implementation that ran on a PDP-11
(I think this was *the* original Modula-2 implementation). It was
a neat little system--sigh...

Lawrence D'Oliveiro                       fone: +64-71-562-889
Computer Services Dept                     fax: +64-71-384-066
University of Waikato            electric mail: ldo@waikato.ac.nz
Hamilton, New Zealand    37^ 47' 26" S, 175^ 19' 7" E, GMT+13:00
Just when you thought it was safe to crawl back behind the
refrigerator... PEST EXTERMINATORS II!

lins@Apple.COM (Chuck Lins) (12/13/90)

In article <2506.276672e0@waikato.ac.nz> ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University) writes:
>Wouldn't it be nice if the MPW Linker supported Modula-2 and like-minded
>languages? Specifically, it should do the following:
>
>* Automatically sort initialization code for modules into the right
>  sequence, based on their import relationships (if A imports B
>  which imports C, then C should initialize before B, which in turn
>  should initialize before A).
An intelligent compiler will do this at the module level. And there are
techniques which ensure that a module is initialized only once. Your compiler
should be generating code to do this. Yes, I know you'd like to see this
happen automatically for all modules in an app. But the linker first has to
be aware of initialization code and it must be identified in the .o file. Not
technically difficult, but you've got to convince the MPW team that this is
important. Believe me, there's much more interest in Modula-2, etc outside of
Apple than within.

>* Check for and *disallow* circular imports (I don't care what
>  Niklaus Wirth says, circular imports are wrong)--if A imports
>  B which imports C which imports A, then this is an error.
>  All right--it should at least be a warning.
I don't know what the new Modula-2 standard will say, but this will probably
end up being more important than what Prof. Wirth thinks. Especially since
the good Professor has moved onto to something called Oberon. Of course, you
can't have circular imports in Oberon :-)

>* Support checking of compilation dates/times on modules, so that
>  if A and B import C, the Linker can check that they import
>  the same version of C (to ensure that both A and B are recompiled
>  if the interface to C has changed).
Compilers can do this now by exporting a dictionary record consisting of the
module name and the module key (timestamp). Of course, the linker can't tell
you what version was really expected however. Which is why I expect you'd
like to see support in the linker. Ideally, the Make file should catch this
and recompile for you.

>
>was part of a standalone Modula-2 implementation that ran on a PDP-11
>(I think this was *the* original Modula-2 implementation). It was
>a neat little system--sigh...
The original Modula-2 system was created on the Lilith by Prof. Wirth.


-- 
Chuck Lins               | "Is this the kind of work you'd like to do?"
Apple Computer, Inc.     | -- Front 242
20525 Mariani Avenue     | Internet:  lins@apple.com
Mail Stop 37-BD          | AppleLink: LINS@applelink.apple.com
Cupertino, CA 95014      | "Self-proclaimed Object Oberon Evangelist"
The intersection of Apple's ideas and my ideas yields the empty set.

russotto@eng.umd.edu (Matthew T. Russotto) (12/13/90)

In article <47309@apple.Apple.COM> lins@Apple.COM (Chuck Lins) writes:


>important. Believe me, there's much more interest in Modula-2, etc outside of
>Apple than within.

In fact, there is a Modula-2 compiler for MPW (2.0.2, anyway)-- or at least,
there was.


--
Matthew T. Russotto	russotto@eng.umd.edu	russotto@wam.umd.edu
     .sig under construction, like the rest of this campus.

n67786@assari.tut.fi (Nieminen Tero) (12/14/90)

In article <1990Dec13.003115.9409@eng.umd.edu> russotto@eng.umd.edu (Matthew T. Russotto) writes:

   In article <47309@apple.Apple.COM> lins@Apple.COM (Chuck Lins) writes:


   >important. Believe me, there's much more interest in Modula-2, etc outside
   >of Apple than within.

   In fact, there is a Modula-2 compiler for MPW (2.0.2, anyway)-- or at least,
   there was.

If you are referring to SemperSoft Modula-2, they should have (had) a version
for MPW 3.0 also. At least I got libraries for 3.0 and had to change them for
use under 2.0.2 (I didn't have 3.0 at the time). But I hear that the company
has discontinued since :(.

   --
   Matthew T. Russotto	russotto@eng.umd.edu	russotto@wam.umd.edu
	.sig under construction, like the rest of this campus.
--
   Tero Nieminen                    Tampere University of Technology
   n67786@cc.tut.fi                 Tampere, Finland, Europe
-- 
   Tero Nieminen                    Tampere University of Technology
   n67786@cc.tut.fi                 Tampere, Finland, Europe

ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University) (12/14/90)

In <47309@apple.Apple.COM>, lins@Apple.COM (Chuck Lins) says

"An intelligent compiler will do [automatic ordering of initialization
code] at the module level. And there are techniques which ensure that
a module is initialized only once. Your compiler should be generating
code to do this."

I know, and it does. And I suspect nearly every Modula-2 compiler in
the world uses the same technique: call the initialization code for
*every* module you import, whether some other module imports it as
well or not; at the other end, the initialization routine maintains
a global flag which indicates if it's been called once or not, so
it can avoid repeating itself on subsequent calls. It's a helluva
hack, and it doesn't solve the circularity problem.

Actually, it's possible to extend this quite simply to detect
circularities, but you'll only pick them up this way when you come
to run the program, not at link time, which is when it should
be happening.

"...you've got to convince the MPW team that this is important.
Believe me, there's much more interest in Modula-2, etc outside
of Apple than within."

I didn't realize MPW was primarily meant as an in-house development
environment, but never mind.

"Ideally, the Make file should catch [out-of-date module symbol tables
and object code] and recompile for you."

Yes, but the Linker should also check, so that if I didn't get the
Makefile *quite* right, I'll have some explanatory messages to tell
me what went wrong, instead of a program that seems to build OK,
but just acts funny.

And finally, in a comment on my statement about the PDP-11 implementation
of Modula-2 being the original one:

"The original Modula-2 system was created on the Lilith by Prof. Wirth."

Yes, but he had to port it to the Lilith from somewhere...

Lawrence D'Oliveiro                       fone: +64-71-562-889
Computer Services Dept                     fax: +64-71-384-066
University of Waikato            electric mail: ldo@waikato.ac.nz
Hamilton, New Zealand    37^ 47' 26" S, 175^ 19' 7" E, GMT+13:00

ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University) (12/14/90)

In <1990Dec13.003115.9409@eng.umd.edu>, russotto@eng.umd.edu
(Matthew T. Russotto) says

"...there is a Modula-2 compiler for MPW (2.0.2, anyway)-- or at least,
there was."

There are two of them currently available that I know of--the P1 and
Metrowerks ones. I've been using the latter for close to three months,
and my comments arise from my observations on the things it has to do
to work in the MPW environment.

Lawrence D'Oliveiro                       fone: +64-71-562-889
Computer Services Dept                     fax: +64-71-384-066
University of Waikato            electric mail: ldo@waikato.ac.nz
Hamilton, New Zealand    37^ 47' 26" S, 175^ 19' 7" E, GMT+13:00

lins@Apple.COM (Chuck Lins) (12/15/90)

In article <N67786.90Dec13170444@assari.tut.fi> n67786@assari.tut.fi (Nieminen Tero) writes:
[stuff about the SemperSoft compiler which doesn't exist anymore]

The only worthwhile Modula-2 compiler still commercially supported are the
Metrowerks compilers. They have a good MPW version and a standalone version
similar to the Think compilers (ie environment). Macmillian Publishers also
sells a $35 student version of their standalone compiler. Recently, ETH
Zuerich (where Prof. Wirth himself works) decided to supply this student version
to _all_ of their undergraduate students. The compilers are _very_ fast, the
environment is reasonably nice (though not as many features as Think).

Now I know the next question is 'where can I order?' :-) Look in you latest
MacTutor for the advertiser index. Look up Metrowerks. Find that page number.
(In the Nov 90 issue it's page 46). Then call (514) 458-2018. The price I
believe is $150 or the MPW version. The standalone version is similar (but
perhaps a bit more, maybe $179 or something like that).

This is the best thing you can you for yourself until you're ready to move up
to Oberon :-) [flames sent to an IBM LAN]

-- 
Chuck Lins               | "Is this the kind of work you'd like to do?"
Apple Computer, Inc.     | -- Front 242
20525 Mariani Avenue     | Internet:  lins@apple.com
Mail Stop 37-BD          | AppleLink: LINS@applelink.apple.com
Cupertino, CA 95014      | "Self-proclaimed Object Oberon Evangelist"
The intersection of Apple's ideas and my ideas yields the empty set.

urlichs@smurf.sub.org (Matthias Urlichs) (12/15/90)

In comp.sys.mac.programmer, article <47309@apple.Apple.COM>,
  lins@Apple.COM (Chuck Lins) writes:
< In article <2506.276672e0@waikato.ac.nz> ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University) writes:
< >Wouldn't it be nice if the MPW Linker supported Modula-2 and like-minded
< >languages? Specifically, it should do the following:
< >
< >* Support checking of compilation dates/times on modules [...]
< [...]  Ideally, the Make file should catch this
< and recompile for you.
< 
Which boils down to the fact that Mr.Programmer has to write a politically
correct Makefile. (If the Modula-2 compiler writer was intelligent enough (as
is the case with the p1 compiler; don't know about the others), he has
thoughtfully supplied a tool to create Makefiles from your source modules.

NB: Things get very bad when having one "object" (normally a resource file)
depend on more than one file (with more than one rule for this).
You can probably think of whatever happens when the second update fails and
you try to rerun the Makefile.

-- 
Matthias Urlichs -- urlichs@smurf.sub.org -- urlichs@smurf.ira.uka.de     /(o\
Humboldtstrasse 7 - 7500 Karlsruhe 1 - FRG -- +49+721+621127(0700-2330)   \o)/

Lawson.English@p88.f15.n300.z1.fidonet.org (Lawson English) (12/18/90)

Lawrence D'oliveiro, Waikato Univer writes in a message to All

LDW> I didn't realize MPW was primarily meant as an in-house development 
LDW> environment, but never mind. 

My understanding is that MPW is Apple's official development environment, 
meant
to satisfy the Apple requirement that all in-house programs (such as the ROM,
the OS, HyperCard, etc) are completely owned by Apple. The fact that MPW is
sold to third-part developers for their own use, and the advantage that MPW
offers to said developers by providing a consistant platform for various 
compilers,
is merely icing on the cake: MPW is meant for Apple, others are welcome to use
 
it, but it's there for Apple's use, first and foremost.

Lawson
 

 

--  
Uucp: ...{gatech,ames,rutgers}!ncar!asuvax!stjhmc!300!15.88!Lawson.English
Internet: Lawson.English@p88.f15.n300.z1.fidonet.org