POV-Ray : Newsgroups : povray.advanced-users : union of unions Server Time
29 Jul 2024 14:22:41 EDT (-0400)
  union of unions (Message 24 to 33 of 43)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: Philippe Lhoste
Subject: Re: union of unions
Date: 10 Sep 2002 12:47:59
Message: <Xns9285BF048AD6DPhiLho@204.213.191.226>
"Rune" <run### [at] mobilixnetdk> wrote in news:3d7e1089@news.povray.org:

> "Better" is a subjective term. "Widely used" is a rather objective term,
> and very often, things are widely used for a good reason. And I don't
> think there is any doubt about which POV-Ray style is more widely used?
> 
> Rune

IE and Windows are widely used. Is it for a good reason, or because of 
Microsoft politics? Note: I am a Windows user only :-)

Most people in France don't use their turning lights (clignotants). Is it 
for a good reason? (OK, that's a negative example.)

Hamburgers and Coca-Cola are widely consummed. Are they de facto good food?

I can go on and on, with more or less disputable examples... :-)

More on the topic, Kernighan & Richie's C style, ie. with opening soft brace 
on the same line of the statement, were used in their book. It was the 
learning book of most C programmers. That's why their style was so widely 
used. Probably the same for the POV-Ray style...
I used K&R first, then I saw good arguments on the aligned braces style, and 
since then I sticked to it. With modern displays, compactness is not such a 
must. And for a more global view, printing is a solution.

Note: for C code, programs like AStyle can help to switch from a format to 
another. Perhaps we should make something similar for POV-Ray. I wish I have 
one when I look at some code :-)

-- 
--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--
Philippe Lhoste (Paris -- France)
Professional programmer and amateur artist
http://jove.prohosting.com/~philho/


Post a reply to this message

From: Warp
Subject: Re: union of unions
Date: 10 Sep 2002 13:00:00
Message: <3d7e250f@news.povray.org>
Rune <run### [at] mobilixnetdk> wrote:
>> My point is that it's easier to spot that "something"
>> if it has a peculiar shape, like '{'.

> (1) That's a statement not supported with an objective argument. I
> happen to disagree.

  I don't understand this. If you are told "look for *anything* at this
indentation level", I think that's a bit slower task to do than "look
for a { at this indentation level". With the later you are only searching
for a specific character (which is usually easy to spot) and you can just
visually skip anything else. With the former you can't skip anything, but
you have to visually check everything that could be a candidate for what
you are searching for.

  Also your indentation is more illogical. The starting character of the
code block is completely disconnected from the code block in question,
and could be located virtually anywhere with respect to the code block.
The starting character is also completely and arbitrarily misplaced
with respect to the ending character.
  IMO it's more logical that the starting character of the code block is
always located at the same place with respect to to the code block and
the block ending character.

  When someone posts a povray code showing some problem and I need to
read the code and understand it, usually the first thing I have to do
is to re-indent it by placing the brackets in their proper places.
That way it's a lot easier to see matching pair and, for example, if
an opening bracket is missing or whatever. It's a lot more difficult
to understand the code indented in your way.
  On the other hand, I don't remember anyone complaining that my way is
more difficult to understand. (Of course you could complain as a reply
to this, but I think that would be quite artificial.)

-- 
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  - Warp -


Post a reply to this message

From: Rune
Subject: Re: union of unions
Date: 10 Sep 2002 13:27:22
Message: <3d7e2b7a@news.povray.org>
Philippe Lhoste wrote:
>

I didn't properly explain what I meant when I said that things are often
widly used for a good reason. I was talking about situations where you
have several competitive alternatives. For example, out of the search
engine alternatives, google is most widely used (I think?), and for a
good reason.

> IE and Windows are widely used. Is it for a good
> reason, or because of Microsoft politics?

It's for good reasons, although you may not like the reaons. For
example, Windows is the platform most widely supported by software (I
think), and that is a good reason to use Windows.

> Most people in France don't use their turning
> lights (clignotants). Is it for a good reason?

That's not the kind of comparisons I was talking about.

> Hamburgers and Coca-Cola are widely consummed.
> Are they de facto good food?

Hamburgers and Coca-Cola are widely consumed compared to what exactly? I
think that water is more widely consumed. It doesn't make sense to do
comparisons like these... Besides, quality is certainly not the only
criteria for determining if something is widely used or not. There can
be many other good reasons than quality.

> More on the topic, Kernighan & Richie's C style, ie.
> with opening soft brace on the same line of the
> statement, were used in their book. It was the
> learning book of most C programmers. That's why
> their style was so widely used.

Yes, but...

> Probably the same for the POV-Ray style... I used
> K&R first, then I saw good arguments on the aligned
> braces style, and since then I sticked to it.

See? People can just change their style. I think that if a style did not
work very well, then most people would switch to other alternatives.

> With modern displays, compactness is not such a must.

But it's still a good thing (when it doesn't hurt readability).

> And for a more global view, printing is a solution.

No thanks. :)

> Note: for C code, programs like AStyle can help to
> switch from a format to another. Perhaps we should
> make something similar for POV-Ray. I wish I have
> one when I look at some code :-)

Me too! :)

Rune
--
3D images and anims, include files, tutorials and more:
rune|vision:  http://runevision.com (updated Sep 8)
POV-Ray Ring: http://webring.povray.co.uk


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: union of unions
Date: 10 Sep 2002 15:34:45
Message: <3d7e4955@news.povray.org>
In article <3d7dd67f@news.povray.org> , Warp <war### [at] tagpovrayorg>  wrote:

>   The problem is that the "standard" tab setting is 8 spaces, which is a bit
> too much for code indentation...

In broken (Win)DOS editors perhaps, on Macs it has been four since 1984...
;-)

    Thorsten

____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: union of unions
Date: 10 Sep 2002 15:43:45
Message: <3d7e4b71@news.povray.org>
In article <Xns### [at] 204213191226> , Philippe Lhoste 
<Phi### [at] GMXnet>  wrote:

> More on the topic, Kernighan & Richie's C style, ie. with opening soft brace
> on the same line of the statement, were used in their book. It was the
> learning book of most C programmers. That's why their style was so widely
> used. Probably the same for the POV-Ray style...
> I used K&R first, then I saw good arguments on the aligned braces style, and
> since then I sticked to it. With modern displays, compactness is not such a
> must. And for a more global view, printing is a solution.
>
> Note: for C code, programs like AStyle can help to switch from a format to
> another. Perhaps we should make something similar for POV-Ray. I wish I have
> one when I look at some code :-)

It should also be noted that the ISO C++ standard uses both styles in its
examples.  So if ISO sees no reason to standardize on one, and has neither
found a common agreement (or the need to have one), I don't think there is a
need to have one for POV-Ray anywhere.

That said, my personal preference goes along with the indentation style used
in the POV-Ray core source code (which uses aligned braces), and as all
modern editors support tab width settings and come with reasonable defaults
(i.e. not 8 spaces for one tab), I used tabs ever since (1988)...


    Thorsten

____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: union of unions
Date: 10 Sep 2002 15:46:52
Message: <3d7e4c2c@news.povray.org>
In article <3d7dd67f@news.povray.org> , Warp <war### [at] tagpovrayorg>  wrote:

>> You do have to be careful only to use tabs for indentation though, and not
>> formatting purposes.
>
>   The problem is that the "standard" tab setting is 8 spaces, which is a bit
> too much for code indentation...

Wasn't it you who recently argued to drop old and broken programs of a
specific kind?  Now you argue we all should support old and broken programs
used by less than 0.1% of the existing computer users???  ;-)


    Thorsten


____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From: Fidel viegas
Subject: Re: union of unions
Date: 10 Sep 2002 17:27:50
Message: <B9A42191.4811%fidel.viegas@artrecognition.co.uk>
in article 3d7d43ad$1@news.povray.org, JRG at jrg### [at] hotmailcom wrote on
10/9/02 1:57 am:

> "Slime" wrote:
>>> But even if we assume that the two styles are equally good, it will
>>> still make life easier for coders if most people used the *same* style
>>> rather than different styles.
>> 
>> 
>> To be honest, I think a more worthwhile debate would be whether to use tabs
>> or spaces for indentation.
>> 
>> Personally, I'm all for tabs.
> 
> Sure... but TWO SPACES tabs, mind you...

I agree with you on this one Jonathan.

Fidel.


Post a reply to this message

From: Rune
Subject: Re: union of unions
Date: 10 Sep 2002 18:00:50
Message: <3d7e6b92@news.povray.org>
Warp wrote:
>   I don't understand this. If you are told "look for
> *anything* at this indentation level", I think that's
> a bit slower task to do than "look for a { at this
> indentation level". With the later you are only
> searching for a specific character (which is usually
> easy to spot) and you can just visually skip anything
> else. With the former you can't skip anything, but
> you have to visually check everything that could be a
> candidate for what you are searching for.

There are no "candidates". It's always the first thing you find (on that
indention level), which is what you're looking for. It's not like these
are several things you have to look at, and then figure out which one is
the correct one.

> Also your indentation is more illogical.

By your definitions.

> The starting character of the code block is
> completely disconnected from the code block in question

I see the { character as an extension of the keyword coming before it,
and that marks the start of the block. The } character marks the end of
the block. The line defining the start of the block is on the same
indention level as the line defining the end of the block. This is
completely logical.

I acknowledge that your style is also completely logical, I just prefer
the style I use for several other reasons.

> The starting character is also completely and arbitrarily
> misplaced with respect to the ending character.

I really don't know what you mean.

> IMO it's more logical that the starting character
> of the code block is always located at the same
> place with respect to to the code block and the
> block ending character.

In the style I use, the starting *line* of the code block (keyword + {)
is always located at the same place with respect to the code block as
the block ending *line* (})

>   When someone posts a povray code showing some
> problem and I need to read the code and understand
> it, usually the first thing I have to do is to
> re-indent it by placing the brackets in their
> proper places.

Same here.

> That way it's a lot easier to see matching pair
> and, for example, if an opening bracket is
> missing or whatever. It's a lot more difficult
> to understand the code indented in your way.

In my experience, it's more difficult to understand the code in *your*
way. People are different.

>   On the other hand, I don't remember anyone
> complaining that my way is more difficult to
> understand. (Of course you could complain as a
> reply to this, but I think that would be quite
> artificial.)

Well, there was that one time where you had missed a closing bracket in
your code. There's a slight chance that it may have been someone else,
but I'm pretty sure it was you. My point below is valid either way.

Back then, it *did* take me a long time to find the error, because I
found the indention confusing, and I did indeed reindent the code to be
able to find it. However, as I respect your choice (or whoever it was)
to use a different style, I certainly didn't "complain", and still
don't. I would find it rather rude if people complained about the coding
style I have chosen to use, since it makes perfectly sense and is even
widely used.

Rune
--
3D images and anims, include files, tutorials and more:
rune|vision:  http://runevision.com (updated Sep 8)
POV-Ray Ring: http://webring.povray.co.uk


Post a reply to this message

From: Ken
Subject: Re: union of unions
Date: 10 Sep 2002 21:50:39
Message: <3D7EA263.8AF6D710@pacbell.net>
Warp wrote:

>   When someone posts a povray code showing some problem and I need to
> read the code and understand it, usually the first thing I have to do
> is to re-indent it by placing the brackets in their proper places.

Whenever I try to understand your code I have to remove your indenting
to understand it :)

-- 
Ken Tyler


Post a reply to this message

From: Anton Sherwood
Subject: Re: union of unions
Date: 11 Sep 2002 00:20:40
Message: <3D7EC530.25D91ABF@pobox.com>
Warp wrote:
>   This is nitpicking, but IMHO it's easier to spot matching brackets
> when they are in the same column

Run away, run away!

-- 
Anton Sherwood, http://www.ogre.nu/


Post a reply to this message

<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>

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