[Fwd: Language Syntax Suggestion]

Matthew Tuck matty@box.net.au
Mon, 22 Feb 1999 00:04:46 +1030


Hans-Dieter Dreier wrote:

> But certainly there has to be a balance: If the compiler is too complicated, it
> will also be big, slow and buggy; this also indicates that the language it
> processes is somewhat complicated and will inevitably contain a lot of special
> cases and therefore be hard to understand. See C++. The simpler and more
> orthogonal a language, the easier to learn and implement (at least generally
> speaking). The art is to get all the functionality you want with as few
> different concepts as possible.

That's why I favour the shorthand approach.  You don't have to know the
shorthands to be able to program the language, but they help, and they
aren't simply two different ways of doing things, they're a easier way
of doing the same thing.

The trouble with "the art of getting all the functionality" is general
concepts tend to be fine with general programming, but often the general
feature is not needed.  An example is defining a whole class just to get
a method to act like a procedure parameter.  The object-oriented concept
is more general and eradicates the need for procedure parameters, but
makes them longer to type.  Hence a shorthand might be useful.

> I remember the ol' days when OOP was experimental: The old languages likeFortan
> IV and Algol60, later C were a lot easier to learn and you could write decent
> programs in them as well. Many things have grown more complicated with the
> advent of OOP.

If you program imperatively in an object-oriented language I imagine it
would be, but I've always found object-oriented languages to make things
easier.  Sure, what's there is harder to handle (visualising class
hierachies and stuff), but there's less of it, making it easier overall.

> IMHO, you should have pretty good reasons if you deviate too much from what
> people are used to. Fact is, they are used to infix notations and some
> standards for using special characters. Just show a lisp program to someone who
> is not used to their use of ' and he is likely to be confused.

Well that's what tends to happen, whether that's what should happen is
another matter entirely.  Syntax-independence could improve this
situation somewhat, allowing you to choose how terse, verbose you want
it.
 
> As long as it can be expressed as an AST (abstract syntax tree) and the
> underlying VM can handle it, there's no reason why you should not design your
> own syntax.

Yes, it would be an AST, possibly with extensions for defining and
handling view or user-defined shorthands (what I call extendible ASTs).
 
> I would like the idea to have a functional language subsystem, too. An engine
> for such a thing must be interesting to write. Since we will have garbage
> collection, it could also fit nicely into our memory model.

I don't know that it would have to be an engine.  What I've been
thinking of has been more of a integrated functional capability.  Some
functional language aspects would not be present, such as lazy
evaluation and infinite lists, but things like referential transparency
and higher-order functions would be.  The existing imperative concept of
a function could be adapted to support this.

-- 
     Matthew Tuck - Software Developer & All-Round Nice Guy
             mailto:matty@box.net.au (ICQ #8125618)
       Check out the Ultra programming language project!
              http://www.box.net.au/~matty/ultra/