X-Abuse-Report:
[email protected]
Message-ID: <
[email protected]>
Path: senator-bedfellow.mit.edu!bloom-beacon.mit.edu!newsfeed.stanford.edu!news.isc.org!sjc70.webusenet.com!news.usenetserver.com!border1.nntp.sjc.giganews.com!nntp.giganews.com!newsfeed3.easynews.com!newsfeed1.easynews.com!easynews.com!easynews!newsfeed-east.nntpserver.com!nntpserver.com!news.teranews.com!not-for-mail
Date: Wed, 24 Mar 2004 00:36:07 GMT
Lines: 456
User-Agent: Microsoft-Outlook-Express-Macintosh-Edition/5.02.2022
Subject: Mops FAQ
From: Mike Hore <
[email protected]>
Newsgroups: comp.lang.forth.mac
Mime-version: 1.0
Content-type: text/plain; charset="US-ASCII"
Content-transfer-encoding: 7bit
Xref: senator-bedfellow.mit.edu comp.lang.forth.mac:4249
=========== Mops FAQ - March 2004 (current version: 5.4.1) =============
G'day. (I'm Australian, OK?) Welcome to the Mops FAQ.
Please read this before emailing me with a problem - this may save both
you and me some time. But if you have to email me, please refer to
the section below on how to submit a problem report.
-- Mike.
-----------------------------------------------------------------------
HOW TO SUBMIT A BUG/PROBLEM REPORT
This should be very simple and obvious, but bitter experience proves that
when somebody hits a problem, in the heat of the moment, the obvious
suddenly becomes surprisingly obscure. So let me spell out what to do.
No, I don't need the color of your eyes or hair, nothing unnecessary,
just enough to get me on the track to fixing the problem.
I need:
1. The code that gives the problem. See if you can narrow it
down as much as possible -- you're the one who know what your
code is supposed to do. Remember that my ability to read minds
is sadly limited.
Please make it so that I can just load it, execute some word,
and see the problem come up.
2. The expected behavior. If it was working properly, what SHOULD
have happened?
3. The actual behavior. I know I should see this for myself at
step 1, but my machine/system is probably configured differently
to yours, and this might be important.
That's all. If you can just do this, I should be able to track it
down quickly. And I'll be so delighted with the helpful bug report
that I'll probably do it right away!
(All this is so obvious that you're probably surprised that I need
to put this section in at all. But it's true. Isn't life strange?)
To email me, you can find my email address on the website:
<
http://www.powermops.org>
-- I don't like to put my email address in plain text in a
newsgroup posting.
Now let's get on with the FAQ.
-----------------------------------------------------------------------
Q: What is Mops?
A: Mops is a public-domain development system for the Mac. It's based on
Forth, with extensive OOP extensions, along the lines of Smalltalk. It
comes with a class library which gives support for all the normal Mac
interface functions. While not as full-featured as PowerPlant or MacApp,
say, it's very adequate for the kind of applications which might be
developed by a single programmer.
Q: Where did it come from?
A: Mops is derived from Neon, which was one of the first languages
for the Mac that allowed actual development on the Mac itself. It's a
close cousin to Yerk, which is a more "conservative" development of Neon,
basically aimed at keeping up with later Macs and systems while
remaining fully compatible with Neon. Mops is more "radical". It's a
complete reimplementation which compiles native (68K and PowerPC)
code instead of the usual Forth threaded variety. It's very fast -- about
as fast as anything on the Mac in fact. It has a few other improvements
over the original Neon, such as multiple inheritance, public ivars,
temporary (local) objects and object references.
Q: Where can I get it?
A: The most up-to-date copies of Mops can be downloaded via
the website:
<
http://www.powermops.org>
I highly encourage you to check this site every month or so
for new updates.
Some other Mops code is available, and there various other
useful links there.
If you've obtained Mops from somewhere else, I recommend you
check on the web site to be sure you have the latest version.
There are some ancient versions around.
Q: Where can I find Mops discussion?
A: The primary place to find discussion of Mops is the newsgroup
comp.lang.forth.mac. This is not exclusively Mops, but Mops is a
primary topic of discussion.
Also the MegaWolf forum
<
http://forums.megawolf.com/phpBB2/index.php>
has a section for Mops discussion. This may be your best bet
should you not happen to have newsnet access, though I don't
check it very often.
There may be other places on the net with an active interest
that we haven't listed here. If you should know of one, please
let this FAQ's maintainer know about them!
Q: Do you have any other sample code available, apart from
what's at those locations?
A: Sorry, I can't help much. I've only written two "real"
Mops applications myself, and I'm not free to distribute
the source. Most of my Mops time has been spent on developing
it rather than writing applications in it. If the above ftp
and web sites don't have what you want, try posting on
comp.lang.forth.mac or the MegaWolf forum - maybe somebody
else there can help.
Q: Could I learn Mac programming with Mops?
A: You could make a good start. Mops comes with an on-line
manual, which is derived from the original Neon manual.
This assumes a very basic level of knowledge about programming,
and none about the Mac. However to move on past the beginner
stage with Mac programming, you'll really need to
read some of Inside Macintosh. You can certainly keep
using Mops, though!
Q: Could I learn OOP with Mops?
A: Definitely! - for the same reason as in the last question.
OOP was still very new when Neon came out, so the manual
explains everything from a very basic level.
Q: Can I write things like Extensions or Control Panels
in Mops?
A: No, sorry, you can't do it. Mops only does applications,
and shared libraries on PowerMacs. In fact with OSX and shared
libraries, the days of Extensions etc. as such are pretty
much over.
Q: What's the minimum system I need to run Mops?
A: I used to say Mac Plus or 512KE, 4 megs RAM,
4 megs spare hard disk space -- but I doubt there
are any of these around any more. Let's just say
very minimum. If you've got any sort of Mac, you
should be able to run it.
Q: Is Mops Carbon-compliant?
A: It certainly is!
Q: Does Mops run "natively" under OSX?
A: Yes! The latest versions of Mops runs under OSX (and any
"classic" versions of Mac OS 8 or 9 with CarbonLib installed).
(The last of the "classic" (non-Carbon) releases is also
still available for compatibility with older versions of
Mac OS without CarbonLib.)
Q: What about Cocoa?
A: Remember that this is really a new OS -- it's based on
the old NextStep, not the Mac OS at all. To get Mops to
use a whole new API would be a gigantic undertaking,
amounting to a complete reimplementation, so basically
it's not going to happen unless somebody with a lot of
time volunteers.
However there is now a mechanism where you can do an API
call to any of the Cocoa frameworks -- see under "Contributions"
on the website.
Q: Does Mops support the AltiVec vector extensions found
on Apple's G4-equipped computers??
A: Yes, it does!
If you don't know what AltiVec is, take a look at
<
http://www.mot.com/SPS/PowerPC/AltiVec/> for more information.
Q: Does the Carbon-compliant versions of Mops still support
68K machines?
A: Amazingly, yes! Although, you should be aware that
Mops' 68K code has not changed at all since version 4.0.3.
This version was very stable, so if you have a 68k Mac,
we now recommend you download this version. Since
most people now run Power Macs of some kind, we're not
planning any further 68k development.
Q: I'd like to try Mops, but I don't have a Mac.
A: If you have a Forth that is reasonably close to
the ANS standard, you can download a package that will
let you try the Mops Object model. As this is
implemented entirely in higher-level Forth, it's
not marvellously efficient, but it will let you try
the Mops syntax. This package is available on the
website, under "Contributions".
Note that I haven't finished the heap-based object part
of this package, and in 4 years nobody's asked me for it,
so I don't think I'll bother.
Q: Do you or could you have plans for some other platform,
especially [insert favorite platform here] ?
A: The code generator could certainly be retargetted for
another platform, since it's written in Mops and could be
adapted to any RISC-style instruction set in a fairly
straightforward way. (Intel's EPIC architecture, however,
isn't traditional RISC, so this adaptation would be, let's say,
exciting and challenging. And very time consuming.)
In any case though, Mops is very closely tied to the
Mac API for all its subsidiary services such as memory
allocation and all the GUI stuff. I estimate the amount of
work to be about 6 person-months, for somebody who
understands Mops very well and has access to the target
hardware. I'm certainly not in a position to take it on
myself.
Q: How about a version for [some embedded 68k or PPC machine] ?
A: Same answer as the previous question.
Q: I tried to compile up the system, but then [whatever it
was that went wrong].
A: The latest versions are fully built up, so unless you're
involved in implementing new features, you won't need to
compile them up. You just have to double-click Mops.dic
(68k Mops) or PowerMops, and start using it!
Q: I've just got the latest version, but when I
double-click on Mops.dic on my 68k Mac, I get a crash.
A: The most usual cause of this is that you are upgrading
from an earlier version of Mops, and you still have a copy
of the earlier Mops nucleus around. From the Mac's point of
view, "Mops.dic" is a document belonging to the application
"Mops". When you double-click on "Mops.dic", the Mac
system launches the application "Mops", but if you have
two versions of Mops around, you can't be sure that it will
fire up the latest. In fact, it probably won't. As the
location of words in the nucleus will be different
between versions, you can't have a new dictionary running
on top of an old nucleus - you'll just get a crash. So
trash the old nucleus (if you're the cautious type, save
it offline first).
That way, the Mac is forced to fire up the right version
of Mops.
Q: My code works fine in the Mops environment, but when
I install it as an application [whatever went wrong].
A: There are a couple of things that could be wrong
here. A common situation is if you are using a module
in an installed application, but you've forgotten to put
true setInstall: myModule
somewhere in your code.
That sets the flag that makes Install include it. This
will happen, for example, if you're using dialogs and
you've forgotten to put
true setInstall: dialogMod
somewhere.
Another common source of problems with installed applications
can happen if at compile time you're ticking words, and
comma-ing the resulting execution tokens (xts) into a table,
then at run time executing the words via @ EXECUTE. This might
happen, e.g. if you're porting your application from another
Forth. The Forth standard doesn't guarantee that this sort of
thing will work in a standard system, but it's fairly
commonly done anyway. In Mops there's no problem with
storing an xt at run time then using it later, but it's highly
dangerous to store it at compile time, save it with the
dictionary, then later try to load the dictionary and use
the xt. This is because in Mops an xt is simply
an absolute address, and absolute addresses of locations
in your code will probably change between runs, depending
on where Mops or your application happens to load into the
Mac's memory. The best way to handle this kind of operation
is with a DicAddr, X-Addr or X-Array object. Please
see the section "Addresses--relocatable and absolute" in
Part II of the manual.
Q: Can I use color in a Mops window?
A: You have to make the window a color window. The Window class now
has a new ivar, color?, and a method to set it, setColor: which takes a
boolean flag. So before you send new: or getNew: to your window, do true
setColor: myWindow Then when you send new: or getNew:, the window will
be created as a color window.
Q: How do I plot an Icon / use the Sound Manager / use
an offscreen PixMap / use the serial port / [insert
favorite problem here].
A: Well, this is an interesting question, but as as
this is a general Mac programming problem rather than
something specifically to do with Mops, I'm not really
here to answer this sort of question. Try posting on
comp.sys.mac.programmer.help. I'm doing this in my
spare time, so it's probably not right for me to be
taking time to answer basic Mac programming questions.
I don't have all the answers anyway. I'm certainly not
a substitute for Inside Mac. Read the appropriate
parts first, and if you're still stuck, try the
newsgroup. There are plenty of people willing and able
to help there.
Q: I've written this nifty code, and I'd like you to
look at it and tell me what you think.
A: I'd rather you didn't ask me that. If you go ahead
and do it anyway, I'll probably give you a nice answer
since I don't want to put anybody off and try to be a
nice guy most of the time, but it will go very low on
the priority list and almost certainly never make it
to the top. Maybe consider posting it to
comp.lang.forth.mac.
Q: I tried the code for the WhizBang99 algorithm that
Joe Bloggs posted the other day, but it gave an error.
A: It's very unlikely that I saw the code or have any
idea what you're talking about. Please see above for
how to submit a bug report. If I respond at all, I'm
likely to be less than polite. Should I have to do
detective work to find out what on earth you're talking
about, when you have all the information I need at your
end? Please try to help me, and then I'll be able to
help you.
Q: What about a Windows version?
A: Get Win32Forth (on taygeta). It now supports much
of the Mops OOP model.
Q: I think Mops is great, but it would be even better
with [insert favorite nifty feature here].
A: Are you volunteering? (The person with the vision
gets the job.)
Q: The Manual seems to be out of date, referring to version 4.
A: Yes, that's right - a manual update is waaaay overdue, and is
now underway. It's also now being converted to html. Thanks
to Ed Williams and Rachel "Gnarlodious" for help on this.
Q: Will you continue to support Mops for some time to come?
A: I've been doing it for 17 years now, and don't plan to stop!
Q: Why an oddball language that isn't C++?
A: Try it and see how quickly you can get things done. The
most popular way isn't always the best way. After all,
you're using a Mac, aren't you?
----------------------- FUTURE PLANS ------------------------
The situation with Apple is much less worrying than in the mid
'90s, since the iMacs/eMacs have been very successful, and
the G4s and G5s have done well too. So it looks as if the Mac's
decline in market share has now stopped, although it's hard to
see any real reversal happening any time soon -- the sad reality is
that a Wintel box seems to be good enough for most people.
But the Mac does appear to have a permanent niche in graphics,
multimedia etc. where it's clearly superior, and Apple appears
now to be concentrating in this area. The G5 machines perform
very impressively here, and should consolidate the Mac's grip
in this market segment. Also after an initial settling-in
period, people are starting to get used to OSX and even like
it!
Also, Intel's first implementations of its 64 bit architecture
have been less than impressive -- leading to Itanium being
almost universally referred to as "Itanic". This architecture
relies on very aggressive compiler optimization to utilize the
hardware properly, and as a compiler writer I know only too
well how hard it is to get rid of optimization bugs and have
any real assurance that they're really gone. I, for one,
wasn't surprised at the poor performance.
Current versions of Mops and PowerMops appear to be very stable.
I think the stability of Mops is one of its great features
-- unlike the mob from Seattle, I don't think it's a good
idea to keep changing things in the name of super-cool new
functionality. Every change brings in new bugs -- that's just
life.
------------------ KNOWN PROBLEMS IN 5.4.1, AND FIXES ----------------------
Array bounds violations are not being handled properly. The current version
uses a "trap" instruction which traps to the OS, but there isn't an easy
way for me to catch the trap. The result is that you'll get an
"array index out of bounds" message under OS9, but under OSX you'll
just get an "unexpectedly quit".
This will be fixed properly in the next release.
------------------------------------------------------------------------
Mike Hore
Darwin, Australia _*-_|\
/ \
\_.--._/
v
------------------------------------------------------------------------