[comp.sys.amiga] Draco keywords

cg@myrias.UUCP (Chris Gray) (06/15/88)

In article <1665@vaxb.calgary.UUCP> maloff@calgary.UUCP (Sheldon Maloff) writes:

Previous stuff deleted.

>As a broke student who just graduated I be glad if it stayed PD for a while,
>but, PD or commercial, we learned a little bit in our computer courses,
>very few people enjoy typing words backwards.  Thats my beef, I
>don't like typing corp, or tnemmoc, or fi, or fidne, or ...
>I'd much rather type endproc, or endcomment, or endif.  If you could
>change the language specs to include *READABLE* terminations, just then
>I might think Draco to be serious.  Unfortunately as it stands, I won't
>use any language that forces me to learn how to spell backwards.
>
>Perhaps if I learned the alphabet backwards, that would help :-)

Just to clarify it a little. The reversed keywords used in Draco always match
up with a previous keyword in the same construct. The pairs are:

proc/corp, if/fi, case/esac, do/od

There are no 'tnemmoc' or 'fidne'. The set used was derived in part from the
language Algol68 (all except the proc/corp). All were carefully chosen to be
fully pronounceable and easy to type. The objection to reversed keywords has
been heard before, but I have NEVER heard it from someone who has used the
language for a significant amount of time.
-- 
Chris Gray		Myrias Research, Edmonton	+1 403 428 1616
	{uunet!mnetor,ubc-vision,watmath,vax135}!alberta!myrias!cg

disd@hubcap.UUCP (Gary Heffelfinger) (06/15/88)

From article <612@myrias.UUCP>, by cg@myrias.UUCP (Chris Gray):
> In article <1665@vaxb.calgary.UUCP> maloff@calgary.UUCP (Sheldon Maloff) writes:
> 
> Previous stuff deleted.
> 
>>very few people enjoy typing words backwards.  Thats my beef, I
>>don't like typing corp, or tnemmoc, or fi, or fidne, or ...
>>
More stuff deleted...
>>Perhaps if I learned the alphabet backwards, that would help :-)
Now you're gettin' silly.  :-)

> Just to clarify it a little. The reversed keywords used in Draco always match
> up with a previous keyword in the same construct. The pairs are:
> 
> proc/corp, if/fi, case/esac, do/od
I find this to be a rather refreshing change to the humdrum END or ENDIF
constructs.  

> been heard before, but I have NEVER heard it from someone who has used the
> language for a significant amount of time.
Well said.  After using Draco for even a few weeks I found it to be
quite natural.  I'm always amused by the religious arguments that ensue
when people are faced with something a little different.

Chris, don't change that feature of Draco.  Dare to be different.


> Chris Gray		Myrias Research, Edmonton	+1 403 428 1616









-- 
Gary Heffelfinger   ---   Employed by, but not the mouthpiece of 
                          Clemson University.
---===      Amiga.  The computer for the best of us.     ===---

maloff@calgary.UUCP (Sheldon Maloff) (06/16/88)

In article <612@myrias.UUCP>, cg@myrias.UUCP (Chris Gray) writes:
> In article <1665@vaxb.calgary.UUCP> maloff@calgary.UUCP (Sheldon Maloff) writes:

> >but, PD or commercial, we learned a little bit in our computer courses,
> >very few people enjoy typing words backwards.  Thats my beef, I

> Just to clarify it a little. The reversed keywords used in Draco always match
> up with a previous keyword in the same construct. The pairs are:

> proc/corp, if/fi, case/esac, do/od

> ... All were carefully chosen to be
> fully pronounceable and easy to type. The objection to reversed keywords has
> been heard before, but I have NEVER heard it from someone who has used the
> language for a significant amount of time.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Quite true I suppose.  I use C exclusively at work.  And though some may 
complain about all the braces, parenthesis and terse code used in C, I haven't
heard complaints about it after one has become accustomed to the language, 
either. To each his own I suppose.

|| Sheldon                               ----========== \\        -----======||
|| maloff@calgary.UUCP                      -----====== //  Calgary, Alberta ||
|| {ihnp4!alberta}!calgary!maloff               -----== \\  Past Host of the ||
|| .. eventually, we'll all be scaled by zero and  ---= //  '88 Winter Games ||
|| converge upon the origin ... then we'll party!    -= \\              ---==||

peter@sugar.UUCP (Peter da Silva) (06/17/88)

In article <1922@hubcap.UUCP>, disd@hubcap.UUCP (Gary Heffelfinger) writes:
> From article <612@myrias.UUCP>, by cg@myrias.UUCP (Chris Gray):
> > [some well-reasoned responses to a moderate flame]

> Well said.  After using Draco for even a few weeks I found it to be
> quite natural.  I'm always amused by the religious arguments that ensue
> when people are faced with something a little different.

Now, this is a moderate flame. My initial response to that comment was "what,
you mean like Chris Gray's religious arguments in his Transactor article?".

> Chris, don't change that feature of Draco.  Dare to be different.

I'll second this. Just bear in mind that there are some things in other
languages that Draco doesn't support... like compile-time initialisation of
structures... that it's going to need to support before certain people (such
as I) will consider it a serious competitor to 'C'. Particularly on the Amiga,
where you need to do these things all over the place.

I have a much longer article in the works, but I'm waiting for it to come back
from Chris Gray with his comments.
-- 
-- Peter da Silva      `-_-'      ...!hoptoad!academ!uhnix1!sugar!peter
-- "Have you hugged your U wolf today?" ...!bellcore!tness1!sugar!peter
-- Disclaimer: These may be the official opinions of Hackercorp.

doug-merritt@cup.portal.com (06/17/88)

Chris Gray wrote:
[ in regard to "if/fi" etc in Draco ]
>Well said.  After using Draco for even a few weeks I found it to be
>quite natural.  I'm always amused by the religious arguments that ensue
>when people are faced with something a little different.

Agreed. As a professional language designer, I certainly have my own
personal preferences, and they do not include reversed keywords. But
I would not condemn an entire language for it; this is a very small
esthetic issue. The lingo for such things is "syntactic sugar"...
features of the syntax that sweeten the language for some, and of
course sour it for others. You can't please everybody.

Far more important than such esthetic issues are questions like what
semantic features are supported, and whether the syntax supports
the semantics well. Using "fi" does in fact indicate the semantics
adequately. I don't use Draco so this is just an abstract comment on
my part.

My *real* preference is for using punctuation when possible to minimize
the number of keywords, like C. Or like my own "Valhalla", or like
the language "Kiss" published in Computer Language a few years ago.
	Doug
--
      Doug Merritt        ucbvax!sun.com!cup.portal.com!doug-merritt
                      or  ucbvax!eris!doug (doug@eris.berkeley.edu)
                      or  ucbvax!unisoft!certes!doug

lphillips@lpami.van-bc.UUCP (Larry Phillips) (06/19/88)

Re: DRACO's use of reversed keywords for ending the construct:

  One of the beefs I have with both C and Pascal is that all block
structures end with the same keyword. I personally prefer them to be
distinct for each block type, and it doesn't matter to me whether they are
reversed keywords or ENDXXX, or whatever. I think that the ability to
quickly determine the extent of a structure regardless of minor style
differences is important to a quick grasp of the meaning of a bit of code.



--
If all the MSDos machines were laid end to end,
  they still wouldn't be as fun as a single Amiga.
+----------------------------------------------------------------+ 
|   //   Larry Phillips                                          |
| \X/    {ihnp4!alberta!ubc-vision,uunet}!van-bc!lpami!lphillips |
|        COMPUSERVE: 76703,4322                                  |
+----------------------------------------------------------------+

cosell@bbn.com (Bernie Cosell) (06/20/88)

In article <1809@van-bc.UUCP> lphillips@lpami.van-bc.UUCP (Larry Phillips) writes:
}Re: DRACO's use of reversed keywords for ending the construct:
}
}  One of the beefs I have with both C and Pascal is that all block
}structures end with the same keyword. I personally prefer them to be
}distinct for each block type,  ...

People with this prejudice (which I happen not to share) get around it
by using the preprocessor.  You can do something like
   #define THEN {
   #define ELSE } else {
   #define FI }
If you want to see the "closure" of that approach, if you can get access to a
set of UNIX sources, check out the source for the Bourne shell (although you
might have to find an old set of sources, because I haven't bothered to look
at the shell sources in years, but I hear that at long last someone (probably
at SUN) got fed up with fighting with mock-Algol (yup!) and rewrote the
mess -- it is still the old way in our 4.3 sources).

The compiler won't _enforce_ that you use the correct close to match
the open, of course, but that's what programming discipline is for
(just as the compiler won't force you to put a comment at the head of
every procedure stating what the procedure does).
   __
  /  )                              Bernie Cosell
 /--<  _  __  __   o _              BBN Labs, Cambridge, MA 02238
/___/_(<_/ (_/) )_(_(<_             cosell@bbn.com

lishka@uwslh.UUCP (Fish-Guts) (06/21/88)

In article <1809@van-bc.UUCP> lphillips@lpami.van-bc.UUCP (Larry Phillips) writes:
>Re: DRACO's use of reversed keywords for ending the construct:
>
>  One of the beefs I have with both C and Pascal is that all block
>structures end with the same keyword. I personally prefer them to be
>distinct for each block type, and it doesn't matter to me whether they are
>reversed keywords or ENDXXX, or whatever. I think that the ability to
>quickly determine the extent of a structure regardless of minor style
>differences is important to a quick grasp of the meaning of a bit of code.

     Actually, I find that this is very easy to solve with a few
well-placed comments.  *ALL* of my constructs look like this:

	void
	foobar()
	{
		if( glarch!=snafu ){
			printf("Hello world!");
		} /* if( glarch!=snafu ) */
	} /* foobar() */

It may be a bit "wordy," but I find that when I have about 5 levels of
nested "if's," "switch's," "while's" and whatever else it is much
easier to figure out which closing brace matches with which open brace.
Just personal taste, I guess.

>+----------------------------------------------------------------+ 
>|   //   Larry Phillips                                          |
>| \X/    {ihnp4!alberta!ubc-vision,uunet}!van-bc!lpami!lphillips |
>|        COMPUSERVE: 76703,4322                                  |
>+----------------------------------------------------------------+

					-Chris
-- 
Christopher Lishka                | lishka@uwslh.uucp  
Wisconsin State Lab of Hygiene    | lishka%uwslh.uucp@cs.wisc.edu
Immunology Section  (608)262-1617 | ...!{rutgers|ucbvax|...}!uwvax!uwslh!lishka
"...Just because someone is shy and gets straight A's does not mean they won't
put wads of gum in your arm pits."
                          - Lynda Barry, "Ernie Pook's Commeek: Gum of Mystery"

doug-merritt@cup.portal.com (06/22/88)

Bernie Cosell writes:
>People with this prejudice (which I happen not to share) get around it
>by using the preprocessor.  You can do something like
>   #define THEN {
>   #define ELSE } else {
>   #define FI }

Please don't! This is NOT just a matter of taste. Doing this will break
any and all software tools that could otherwise help you out with various
programming tasks. For instance, doing the above breaks CTAGS. It would
also break syntax-directed editors, etc.

Furthermore, even aside from practical reasons ("but I don't have any
software tools like that so who cares?"), there's a philosophical problem
with it, too. You're trying to redefine the language. Ever hear the
expression, "if it ain't broke, don't fix it"? Well, C is *not* broken!
Sure, some people prefer ALGOL/PASCAL/MODULA style keywords, but it's
not like it makes any real difference which construct a language uses.
 
>If you want to see the "closure" of that approach, if you can get access to a
>set of UNIX sources, check out the source for the Bourne shell
> [...] but I hear that at long last someone got fed up with fighting with
>mock-Algol (yup!) and rewrote the mess

Good example. I've talked to Steve Bourne about this, and he says that
he made a big mistake, and that if he had it to do over again, he'd
write the Bourne shell in plain vanilla C.

Why do you end up "fighting with mock-Algol"? Because: there are many
people in the world who are fluent in C, and many who are fluent in
Algol-variants (like Pascal and Modula 2). There are almost none who
are fluent in Algol-ized C. You create a problem for anyone else who
must deal with your source. You also create a problem for yourself,
because you prevent yourself from getting used to plain C, and *you*
will have a problem with all the other C code in the world that *other*
people write.

Some part of your mind will keep insisting to you that all the C in the
world is written wrong except yours, which is a dangerous mindset,
and will tend to delay your learning curve with the language.

In the late sixties and early seventies, it was all the rage in programming
language design to make languages with fully redefinable syntax. It
was discovered that everyone creates their own programming language that
no one else can deal with, and it causes many problems for no real
purpose. These days extensibility is kept very carefully under control
(e.g. in ADA you can overload operators).

Bottom line: sure, it's a cute approach to programming. But the best
minds in computer science have tried it (and there's many others besides
Steve Bourne), and have decided that it's just not the right way to go.
	Doug
--
      Doug Merritt        ucbvax!sun.com!cup.portal.com!doug-merritt
                      or  ucbvax!eris!doug (doug@eris.berkeley.edu)
                      or  ucbvax!unisoft!certes!doug

doug-merritt@cup.portal.com (06/23/88)

Larry Philips writes:
>		if( glarch!=snafu ){
>			printf("Hello world!");
>		} /* if( glarch!=snafu ) */
                         ^^^^^^^^^^^^^

I often do this too, and I find that the condition is the important
part. I.e. if C used "if" and "fi", I'd still do it, because "fi" is
trivial information, while "glarch!=snafu" is useful.

Matching begin-block with end-block is relatively easy regardless of
language (well, ok, in Lisp it can get hairy...)
	Doug
--
      Doug Merritt        ucbvax!sun.com!cup.portal.com!doug-merritt
                      or  ucbvax!eris!doug (doug@eris.berkeley.edu)
                      or  ucbvax!unisoft!certes!doug

thad@cup.portal.com (06/24/88)

STYLE is very important.  After just completing a 300,000+ line C port,
in retrospect I'm *GLAD* I used (for example):

    if ( condition)
    {
       for ( loop head )
       {
            (loop body);
       }
    }

MUCH much easier to see closure when the opening and closing braces are
indented the same.

doug-merritt@cup.portal.com (06/26/88)

Thad Floryan writes:
>STYLE is very important.  After just completing a 300,000+ line C port,
>in retrospect I'm *GLAD* I used (for example):
>       for ( loop head )
>       {
>       }
>MUCH much easier to see closure when the opening and closing braces are
>indented the same.

Please, let's not start a style controversy. I've been programming in
C since 1976, and I've seen dozens of different styles used, and have
prepared company "progamming style sheets", etc. And there's one thing
that has become absolutely clear:

	THERE IS NO ONE SINGLE "RIGHT" WAY TO CODE C!!!!!!!!!!!

For instance, the original Bell Labs style is to put the open curly
on the same line as the 'for': "for ( loop head ) {". You would say
that's bad, apparently. Yet there are thousands of C programmers who
are used to this style, and who have no problems keeping track of
correct closure.

Give people credit. The important thing is to have a consistent style
that achieves some particular purpose. The rest is personal preference
and quickly becomes a religious war when argued.
	Doug
--
      Doug Merritt        ucbvax!sun.com!cup.portal.com!doug-merritt
                      or  ucbvax!eris!doug (doug@eris.berkeley.edu)
                      or  ucbvax!unisoft!certes!doug

lphillips@lpami.van-bc.UUCP (Larry Phillips) (06/27/88)

In <6801@cup.portal.com>, doug-merritt@cup.portal.com writes:
 >Larry Philips writes:
 >>		if( glarch!=snafu ){
 >>			printf("Hello world!");
 >>		} /* if( glarch!=snafu ) */
                         ^^^^^^^^^^^^^
  Hmmm... I did not write that code. Of course if there is a Larry Philips
on the net that did write it, I apologize to him.

-larry

--
If all the MSDos machines were laid end to end,
  they still wouldn't be as fun as a single Amiga.
+----------------------------------------------------------------+ 
|   //   Larry Phillips                                          |
| \X/    {ihnp4!alberta!ubc-vision,uunet}!van-bc!lpami!lphillips |
|        COMPUSERVE: 76703,4322                                  |
+----------------------------------------------------------------+

maloff@calgary.UUCP (Sheldon Maloff) (06/28/88)

In article <6830@cup.portal.com>, thad@cup.portal.com writes:
> STYLE is very important.  After just completing a 300,000+ line C port,
> in retrospect I'm *GLAD* I used (for example):
> 
>     if ( condition)
>     {
>        for ( loop head )
>        {
>             (loop body);
>        }
>     }
> 
> MUCH much easier to see closure when the opening and closing braces are
> indented the same.

This isn't the newsgroup for it, and this thread has deviated substantially
since I first posted it.  *STYLE* is important.  But nobody is going to
tell me that the above is easy to read ... its basically a dirivative of
the way Pascal code is written with BEGIN ... END.  I would write the same
code as

	if (condition) {
		for (loop head) {
			loop body
		}
	}

Why?  I use an emacs at home and at work that does back paren/bracket/brace
matching.  If that <loop body> is sufficiently large that the two opening
braces are pushed off the top of the screen when I type }, emacs will
copy `for (loop head) {' into the minibuffer at the bottom of the screen.
Likewise for the second } typed.  If I had indented with the style mentioned
above when I type `}'  emacs would echo `	{' which means absolutely
nothing to me as to which brace I just matched.  It all depends on the power
of the tools you have available, and *personal* taste.

With that said I'm swallowing my original words, and am thinking of porting
corewars from C to Draco and giving the program a much needed graphical
interface.  Seems no one sided with me about reverse keywords, so I'm
going to check the grass on the other side...

(Corewars ... Scientific American, November 1986(?))

|| Sheldon                               ----========== \\        -----======||
|| maloff@calgary.UUCP                      -----====== //  Calgary, Alberta ||
|| {ihnp4!alberta}!calgary!maloff               -----== \\  Past Host of the ||
|| .. eventually, we'll all be scaled by zero and  ---= //  '88 Winter Games ||
|| converge upon the origin ... then we'll party!    -= \\              ---==||

lishka@uwslh.UUCP (Fish-Guts) (06/29/88)

In article <1838@van-bc.UUCP> lphillips@lpami.van-bc.UUCP (Larry Phillips) writes:
>
>In <6801@cup.portal.com>, doug-merritt@cup.portal.com writes:
> >Larry Philips writes:
> >>		if( glarch!=snafu ){
> >>			printf("Hello world!");
> >>		} /* if( glarch!=snafu ) */
>                         ^^^^^^^^^^^^^
>  Hmmm... I did not write that code. Of course if there is a Larry Philips
>on the net that did write it, I apologize to him.

     Actually, I wrote the code, but it must've appeared in one of
your messages.  I am somewhat religious about marking my {..}'s or
begin...end's or (...)'s [or etc.].  

     With the strange things that have been happening with the mailers
lately (you know, Cornell spitting stuff up), I am sure this got
goofed in the confusion.  I seriously doubt that even half of my
messages ever get posted outside of Wisconsin, even though I usually
specify a much wider area of distribution.  Oh well, the world (and
even Usenet!) is not perfect ;-)

>-larry

						-Chris
-- 
Christopher Lishka                | lishka@uwslh.uucp  
Wisconsin State Lab of Hygiene    | lishka%uwslh.uucp@cs.wisc.edu
Immunology Section  (608)262-1617 | ...!{rutgers|ucbvax|...}!uwvax!uwslh!lishka
"...Just because someone is shy and gets straight A's does not mean they won't
put wads of gum in your arm pits."
                          - Lynda Barry, "Ernie Pook's Commeek: Gum of Mystery"

lishka@uwslh.UUCP (Fish-Guts) (06/29/88)

In article <6891@cup.portal.com> doug-merritt@cup.portal.com writes:
>Please, let's not start a style controversy. I've been programming in
>C since 1976, and I've seen dozens of different styles used, and have
>prepared company "progamming style sheets", etc. And there's one thing
>that has become absolutely clear:
>
>	THERE IS NO ONE SINGLE "RIGHT" WAY TO CODE C!!!!!!!!!!!

     Actually, I prefer to extend Mr. Merritt's observation:

	There is no one single "right" way to code in any language!!!

>Give people credit. The important thing is to have a consistent style
>that achieves some particular purpose. The rest is personal preference
>and quickly becomes a religious war when argued.
>	Doug

     Well said!

						-Chris
-- 
Christopher Lishka                | lishka@uwslh.uucp  
Wisconsin State Lab of Hygiene    | lishka%uwslh.uucp@cs.wisc.edu
Immunology Section  (608)262-1617 | ...!{rutgers|ucbvax|...}!uwvax!uwslh!lishka
"...Just because someone is shy and gets straight A's does not mean they won't
put wads of gum in your arm pits."
                          - Lynda Barry, "Ernie Pook's Commeek: Gum of Mystery"

thad@cup.portal.com (07/01/88)

Read it again (if you can find the original message in this thread (happy
hunting :-))  ... someone asked something about something, and asked about
style.  I simply showed a simple example of how *I* do it, and why.

Everyone is free to choose their own style; answering someone's question
asking for examples does not constitute a revival of "style-wars"!  :-)

This probably should be in comp.lang.c[++] anyway; at least more interesting
than all the babble about trigraphs.  Sheesh.  :-)

kent@xanth.cs.odu.edu (Kent Paul Dolan) (07/03/88)

In article <1704@vaxb.calgary.UUCP> maloff@calgary.UUCP (Sheldon Maloff) writes:
>In article <6830@cup.portal.com>, thad@cup.portal.com writes:
>> STYLE is very important.  After just completing a 300,000+ line C port,
>> in retrospect I'm *GLAD* I used (for example):
>> 
>>     if ( condition)
>>     {
>>        for ( loop head )
>>        {
>>             (loop body);
>>        }
>>     }
>> 
>> MUCH much easier to see closure when the opening and closing braces are
>> indented the same.
>
>This isn't the newsgroup for it, and this thread has deviated substantially
>since I first posted it.  *STYLE* is important.  But nobody is going to
>tell me that the above is easy to read ... its basically a dirivative of
>the way Pascal code is written with BEGIN ... END.  I would write the same
>code as
>
>	if (condition) {
>		for (loop head) {
>			loop body
>		}
>	}
>
>Why?  I use an emacs at home and at work that does back paren/bracket/brace
>matching.  If that <loop body> is sufficiently large that the two opening
>braces are pushed off the top of the screen when I type }, emacs will
>copy `for (loop head) {' into the minibuffer at the bottom of the screen.
>Likewise for the second } typed.  If I had indented with the style mentioned
>above when I type `}'  emacs would echo `	{' which means absolutely
>nothing to me as to which brace I just matched.  It all depends on the power
>of the tools you have available, and *personal* taste.
>
>With that said I'm swallowing my original words, and am thinking of porting
>corewars from C to Draco and giving the program a much needed graphical
>interface.  Seems no one sided with me about reverse keywords, so I'm
>going to check the grass on the other side...
>
>(Corewars ... Scientific American, November 1986(?))
>

	This is as good an opening as any to promote a technique a
	friend, Paul Medlock, taught me when he taught me Pascal.
	This might seem really simple, but it is a really powerful aid
	in using a block structured language: close all constructs
	before filling them in!  That way, in C, you never worry about
	what bracket you are closing; you always close something on
	the line after you open it, so lining stuff up is trivial.

	Example:  create an if like:

		if () {
		}
		else {
		}

	or like

		if ()
		{
		}
		else
		{
		}

	whichever you prefer, then make the insides.

	For me, in any language, this simple trick speeds up
	development enormously, cuts down bugs a lot, and avoids the
	problems mentioned above.  There is no reason not to do it,
	given facility with a full screen editor.  Another advantage
	in most languages, is that what you build will compile clean
	at any point.

	Sorry if everyone already does this, but from the comments
	above, this seems not to be the case.

Kent, the man from xanth.

peter@sugar.UUCP (Peter da Silva) (07/03/88)

In article ... kent@xanth.cs.odu.edu (Kent Paul Dolan) writes:
> 	This might seem really simple, but it is a really powerful aid
> 	in using a block structured language: close all constructs
> 	before filling them in...

This is a useful technique. If you use vi, emacs, or some other editor
with macro capability you can start the whole thing with one keystroke.

This gives you most of the advantages of a language-specific editor
without having to make do with an editor that's usually crippled in
other areas (LDE on UNIX, the TDI modula-2 editor or Alice on the PC).
-- 
-- `-_-' Peter (have you hugged your wolf today?) da Silva.
--   U   Mail to ...!uunet!sugar!peter, flames to /dev/null.
-- "Running DOS on a '386 is like driving an Indy car to the Stop-N-Go"