[TUHS] tabs vs spaces - entab, detab

John Cowan cowan at ccil.org
Sat Mar 6 06:24:40 AEST 2021

On Fri, Mar 5, 2021 at 9:14 AM Steffen Nurpmeso <steffen at sdaoden.eu> wrote:

> But, not important.  A real change to my coding style came when
> i looked around Plan9 source code, the pragmatism to simply not
> use spaces in language constructs aka statements at all, for
> example "if(a){" instead of "if(a) {" or "if (a) {", and let alone
> "if (a)\nALIGN{\nALIGN" and whatever else.

That way lies APL madness.  To exemplify, Kona is an open-source
interpreter for Arthur Whitney's K version 3 language, which is closely
related to APL, but crams almost all of the APL operators onto single ASCII
characters with massive overloading.  For example, monadic ! is APL "iota",
but dyadic ! is "modulo" if both arguments are numbers and "rotate" if the
right argument is a number and the left argument is a vector.  What any of
these has to do with the rest is beyond me: I had to create a set of flash
cards to help me learn them all.

Well, here's a procedure definition from the Kona source, in a file
helpfully named kc.c (almost all of the source files have 1-2 character

I wds_(K*a,FILE*f,I l)
{ S s=0,t=0;  I b=0,c=0,m=0,n=0,v=0;  K z=0; PDA p=0;
  I o=isatty(STDIN)&&f==stdin;
  { b=parsedepth(p);
    appender(&t,&m,s,n); }
  SW(v){CS(2,show(kerr("unmatched"));GC) CS(3,show(kerr("nest")); GC)}
  free(s); free(t);
  if((v||c==-1)&&z){cd(z); *a=0;}
  else *a=z;
  R v?-v:c; }    // -1 EOF, -2 unmatched, -3 nest

If you want that sort of thing, you can certainly have it.  Note the
single-space ident and the cuddled right braces.  Note also the label
"cleanup:"; presumably a "goto cleanup;" is hidden somewhere in the
single-letter (of course) macros.

John Cowan          http://vrici.lojban.org/~cowan        cowan at ccil.org
The peculiar excellence of comedy is its excellent fooling, and
claim to immortality is based upon one title only: he was a master maker
of comedy, he could fool excellently.  Here Gilbert stands side by side
with him.  He, too, could write the most admirable nonsense.  There has
never been better fooling than his, and a comparison with him carries
nothing derogatory to the great Athenian. --Edith Hamilton, The Greek Way
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20210305/3e470c6a/attachment.htm>

More information about the TUHS mailing list