:: Re: [DNG] Starting outline for the …
Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: Hendrik Boom
Fecha:  
A: dng
Asunto: Re: [DNG] Starting outline for the DNG Safe Programmer Certificate
On Mon, Aug 02, 2021 at 02:03:09AM -0400, Steve Litt wrote:
> Josef Grosch via Dng said on Sun, 1 Aug 2021 14:58:18 -0700
>
> >On 8/1/21 12:50 PM, Steve Litt wrote:
> >> wirelessduck--- via Dng said on Sun, 1 Aug 2021 22:43:35 +1000
> >>
> >>>> On 1 Aug 2021, at 21:56, Hendrik Boom <hendrik@???>
> >>>> wrote:
> >>>>
> >>>> On Fri, Jul 30, 2021 at 01:49:46PM -0400, Steve Litt wrote:
> >>>>> Josef Grosch via Dng said on Thu, 29 Jul 2021 15:32:05 -0700
> >>>>>
> >>>>>
> >>>>>> Another suggestion I have is to use the variable and method
> >>>>>> naming convention that java uses. I like the way it looks and I
> >>>>>> think camel case is more readable than snake case.
> >>>>> This reminds me of something not yet in the outline. The
> >>>>> originating author should place, in comments, near the top, his
> >>>>> or her syntax conventions including naming conventions, brace
> >>>>> placements if not Python, spaces or tabs.
> >>>>>
> >>>>> I'm hidiously guilty of using violating my own conventions (or not
> >>>>> having any), so I should make that document at the start of a
> >>>>> project. Matter of fact, I should make it BEFORE my next project.
> >>>>> Naturally, one such stylesheet must be made for Python, another
> >>>>> for C, etc.
> >>>>>
> >>>>> In an ideal world, here's how I'd do C blocks:
> >>>>>
> >>>>> if(mybool)
> >>>>>    {
> >>>>>    do_my_stuff()
> >>>>>    }  
> >>>> I tend to use
> >>>> if(mybool)
> >>>>   { do_my_stuff();
> >>>>     do_other_stuff);
> >>>>   }

> >>>>
> >>>> I really believe matching braces should be on the same line, or,
> >>>> failing that, at the same level of indentation; i.e., above one
> >>>> another.
> >>>>
> >>>> And I'd like the compile to warn me of deviations from that.
> >>>>
> >>>> -- hendrik
> >>>>
> >>>>> However, I do it the way Vim preformats for me, to make my life
> >>>>> easier:
> >>>>>
> >>>>> if(mybool){
> >>>>>    do_my_stuff()
> >>>>> }

> >>>>>
> >>>>> #ifndef AUTHOR
> >>>>>    char * AUTHOR = "SteveT"
> >>>>> #endif

> >>>>>
> >>>>> AUTHOR
> >>>>>
> >>>>> Steve Litt
> >>> Just use indent(1) and forget about all stying problems? I prefer
> >>> `indent -kr`, none of that GNU styling craziness!!
> >>>
> >>> https://manpages.debian.org/buster/indent/indent.1.en.html
> >> I just spent 2 hours trying out indent. As far as I can tell, -bli
> >> doesn't work, and I could find no way to put statements in block at
> >> the same level with the block's parentheses. So what I want is this:
> >>
> >> int myfunc()
> >>     {
> >>     do_something();
> >>     do_more();
> >>     if(mybool)
> >>        {
> >>        do_special()
> >>        }
> >>     }

>
> [snip]
>
>
> >> SteveT
> >>
> >
> >It looks like you are trying to get what was once called the
> >Whitesmiths style.
> >
> >
> >https://en.wikipedia.org/wiki/Indentation_style#Whitesmiths_style
>
> It is indeed Whitesmith style. I learned it at Santa Monica College's
> Pascal course, and when I busted into programming professionally, I
> used Whitesmith Pascal so everyone used Whitesmith style, except with
> "begin" and "end" instead of braces.
>
> First time I saw the beginning brace at the end of the if() or
> declaration was in the Linux world, and I almost barfed. But because
> the beginning brace at the end of the if() or declartion was default
> for Vim, I started using beginning brace at end.
>
> I still think that for a language that has a begin and end for a block,
> Whitesmith is best. For a language that has stuff like "endwhile" or
> "endif" or "fi", beginning brace at end of if() is what I prefer.


As an old Algol 68 programmer who is accustoed to 'fi', the only layout
that makes sense to me is

  IF condition
  THEN do something
       do more
  ELSE do something else
       do other stuff
  FI


This assumes relatively short keywords.

-- hendrik

>
> >
> >
> >Back when the earth was still cooling, 1991 or so, I worked at
> >Motorola in Chicago and this was the preferred coding style for the
> >project I was a member of. Configuring indent was always a matter of
> >trail and error and the docs could be better.  Using a config file,
> >~/.indent.pro made things easier. I might still have a copy of that
> >file somewhere, I'll look.
>
> I'd love to see it!
>
> Thanks,
>
> SteveT
>
> Steve Litt
> Spring 2021 featured book: Troubleshooting Techniques of the Successful
> Technologist http://www.troubleshooters.com/techniques
> _______________________________________________
> Dng mailing list
> Dng@???
> https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng