POV-Ray : Newsgroups : povray.advanced-users : union of unions : Re: (union of unions); indentation style Server Time
29 Jul 2024 14:17:27 EDT (-0400)
  Re: (union of unions); indentation style  
From: Frank 'Sputnik' Rothfuß
Date: 14 Sep 2002 10:57:44
Message: <3D834E68.BA3FFD7F@computermuseum.fh-kiel.de>
Hi,

I can't decide if I should pour cold water over you all or
throw some dynamite into the flames, so I'll try both --
here comes the third style:

// typical indentation example
keyword { required_parameters
  optional_parameters
  optional_parameters
  }

This is completely logical, because
- *everything* belonging to the keyword is indented,
  including, of course, the "}"
- no (almost) empty line separates the keyword from
  its parameters
- it's easy to find the keyword belonging to a "}":
  (1) look at the "}";
  (2) move your focus to the white space preceding it;
  (3) move your focus up over WHITE space until you see
      BLACK;
  (4) you are looking at the keyword!

It isn't a dogma to me, just a rule of thumb to improve
readability of _my_ code. To check braces, I don't (ab)use
my eyes; 'Match Braces' will do that faster and more reliable
than I ever could. I don't care much about the braces -- they
are for the _computer_, not for me; I don't need them.
Indentation is for humans, that's all _I_ need.
For me the most powerful formatting means is white brace-
free space (horizontally and vertically; and comments, of
course).

The same style can be used for other 'bracing pairs' like
#case/#break, #if/#else/#end:

// typical indentation example
#macro MyObject ( Para )
  DoThis
  DoThat
  #end//macro MyObject

Those who want aligned braces (and 'bracing pairs') might
use my Pascal-Style:

/* typical Pascal indentation */
if Condition then             begin
    DoThis
    DoThat                    end
  else                        begin
    DoOther
    DoMore                    end;

Perfectly aligned AND readable, isn't it? :))

For a real POV-Ray example see my post in p.g on 3rd sept.
concerning with 'Intersection with quartic: bug?'.

Oh, I don't want to convince anybody that my style is the
best -- my intention is to show the friendly coexistence
of 3 (or more) 'truths'.

Make POV, not war!

   Sputnik


e-mail: fr (at) computermuseum (dot) fh-kiel (dot) de


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.