Go to the first, previous, next, last section, table of contents.
Some reasons I stuck with RPN notation for Muq's first programming syntax:
-
A surprising number of my tinyMuck hacker friends reported that they actually liked
tinyMuck MUF. To my surprise! (Before I surveyed them, I'd figured they all used it under
protest.)
-
Forth was developed for interactive at-the-keyboard hacking -- I can't think offhand
of any other major language that was so designed. (Excepting tcsh & kith!) There is room
for a syntax which works well in realtime mode.
-
I've never seen anyone seriously try to drag a Forthlike language into the
modern programming era: I found it fascinating to explore how much it could
be improved with modern facilities without losing its essential character.
-
I've always been distressed by how very bad tinyMuck MUF was -- in many
ways it combines the worst aspects of the Algolic tradition (for example,
explicit compile-edit-debug cycles, black-box compilers) with the worst aspects of the
Forth tradition (for example, unreadable code, obscure bugs). That the original
author of tinyMuck MUF was completely ignorant of Forth, compilers and interpreters
is an explanation but not a justification...
Why not a MUF that combined the best of those traditions?
Here is a quick guide to differences between Muq MUF and tinyMuck MUF for
the experienced tinyMuck hacker:
-
Muq lets you execute code directly from the internal commandline: No edit-compile-run
cycle. You can also interact with Muq directly from the unix commandline (instead of
telnetting in) if you prefer -- I usually do my interactive MUF hacking in an
emacs shell window, which makes it trivial to paste code in, save printout, and edit
and re-run recent expressions.
-
Muq gives you local variables in functions -- no more of those awful
swap drop rot dup
sequences uglifying your code. Local variable assignment syntax is expr -> var
and
global variable assignment syntax is expr --> var
.
-
Muq gives you nice infix notations like
a.b[i]
for the common cases, to reduce
code ugliness. The a[i]
notation is used both for vectors and for the
btree-based indices, which get used like Perl hashes.
-
Muq gives you a variety of new and improved datatypes: Floats, ints
good to over a thousand bits precision (with a modular expenentiation
function fast enough to use for public-key signature sorts of stuff),
structs, objects with multiple inheritance, hashed-btree based Index
objects (used in place of propdirs), vectors, Lisp-style Lists,
Perl4-style regular expressions, anonymous functions, thunks and
promises with implicit forcing, pretty much you name it. And complex
numbers are on the way! grin
-
Muq gives you a variety of nice, vaguely C-like control constructs, including a
case
statement and lots of loops.
-
Muq gives you full-strength C-style printf()s (
]print
) -- man, I miss those in languages
like Java! Also C-style sscanf()s (unprint[
), C-style strftime (printTime
)
and lots more goodies.
-
Muq systematizes the notation for stackblocks and introduces dozens of operators on them
like
|sort
and |uniq
.
-
Muq lets you declare the count of arguments accepted and returned by a function, and
verifies that the declaration is correct. This is good documentation, and can prevent
lots of obscure stack usage bugs.
-
Muq gives you pre-emptive multi-tasking, so you can write MUF code that runs awhile
(or even a daemon that runs indefinitely) without locking up the server completely. With
this goes job forking, message streams with reader/writer synchronization, signals,
jobsets, sessions, tcp/ip and udp via socket objects, millisecond-accurate times and
sleeps...
-
Muq gives you automatic storage management ("garbage collection") to allow serious
programming without serious C-style memory leaks or pointer bugs.
-
Muq gives you a
]rootPopenSocket
primitive for running host subprocesses. This lets
you easily interface the Muq server to external resources.
-
Muq gives you packages to manage global namespace rationally, and dbfiles to divide the
db between hostfiles rationally.
-
Muq hides server process boundaries, so you can interact with data and jobs on other Muq
servers across the Internet without even needing to know the data are remote. (Underneath,
Muqnet uses both public-key and conventional crypto are used to secure remote operation.)
-
Muq authenticates all message stream packets (including those from remote servers) -- spoofing
is much less of a problem on Muq.
-
Muq was written with lots of attention to space and time efficiency --
for example, instruction dispatch overhead was less than 1/3 that of
fuzzball last I checked, and short strings are stored entirely within
the pointer, incurring zero heap space and deallocation overhead.
Go to the first, previous, next, last section, table of contents.