[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
New language syntax
I was at one time very keen on introducing a more C-like syntax to occam or
it's successor, but I've changed my mind a bit. I think that using
indentation as a delimiter is a good
thing. It only really upsets people when they don't understand when they
should indent and outdent (I remember being in a large group of students
bitching about occam's indentation). Experience will teach those people how
to indent properly anyway, so it will simply speed their learning :). Most
of us probably indent code the same way as occam anyway (i.e. we indent at
the start of a block and outdent at the end). How many spaces are used,
where the braces go and whether tabs are used seems to be very personal.
Editing other peoples code can be horrible.
I have to agree with Ian Page that maintaining two separate syntaxes would
be a nightmare.
I've never heard anyone complain about indentation in Python, so why not?
Part of the reason is that Python is not so strict about the type and amount
of whitespace that you use. In occam you must indent and outdent by two
spaces. In Python it doesn't care how many spaces you use or if they are
intermixed with tabs. From occam classes, tabs put in automatically by the
students favorite text editor are a large source of error. All the lexical
analyser should ensure is that the indentation is further in or further out
the current level.
I, for one, will continue to use two spaces for indentation, but it wouldn't
been too painful to allow for some extra flexibility.
The second question is keyword case. I can understand why it is disliked by
some. I think (like Adrian) that it is the BASIC connection that makes
people uncomfortable. We should simply get around this by allowing lower
case keywords. Using upper-case to distinguish keywords is less necessary
these days because of the widespread use of syntax highlighting editors. I
always liked the way Peter writes occam by hand, with underlined lower-case
keywords. Perhaps we could have a graphical folding editor that did that
With regards to program length and so on, we really need to find some way to
make IF's shorter. Is it just me or is:
just a bit too long winded, when
doesn't seem like a problem to me. I know that enforcing the TRUE/SKIP is
supposed to make you think about covering all conditions (which is why it
acts like a STOP), but it really is pretty inconvenient to need FIVE lines
of code just to test a condition! Unfortunately, we need to remember that
IF's can be replicated, so there is something of a syntax clash with my
proposal. Perhaps we could keep the old style if and rename it RIF or
Jim Moores, Quickstone Systems, UK.
> -----Original Message-----
> From: IanPage99@xxxxxxx [mailto:IanPage99@xxxxxxx]
> Sent: 18 December 2000 12:24
> To: P.H.Welch@xxxxxxxxx; occam-com@xxxxxxxxx
> Subject: Re: Software fault forces Ford recall
> In a message dated 12/18/00 12:00:19 GMT Standard Time,
> > I suggest that both concrete syntaxes (syntaces?) be
> allowed. We could
> > have a flag to the compiler to say which one to expect -
> or maybe that
> > could be deduced fairly quickly and automatically?
> Please don't underestimate the problems of having a language
> with two syntaxes (inability to share code, two manuals, two sets
> of training material, etc., etc.)
> Also, with the occam experience to focus our hindsight, it should be
> very clear that the problems of introducing *any* new language
> to an uncaring world are truly awesome.
> Although it only covers a fraction of the syntax, so not all of the
> occam2 syntax and sematics problems have been addressed, the
> Handel-C language already exists, has many users, and is being
> pushed towards standardisation. If you do go ahead, it would be
> nice, eventually to have just one C-like syntax for occam around!
> Whatever your feelings about occam syntax, its ideas are clearly
> right and we have found that users do take readily to the
> C-like syntax
> of our occam-like language. There are now 110+ people employed in
> the company exploiting Handel-C and some wonderful customer
> validation, so something must be right somewhere.
> With the best will in the world towards occam, I have agreed for
> years with Tony Hoare's assertion that "occam really should have
> *been* C"
> Prof. Ian Page,
> Founder, Celoxica Plc, (formerly ESL Ltd.)
> 8 Milton Park, Abingdon, Oxfordshire OX14 4RT