My solution is to use {} for one line blocks and do…end for more
complicated things.
I tried this style for a while. But then every time I added lines to a
one-line block, I had to change {} to do/end.
Today I normally used {} on all blocks, except in Rake files.
My take is: {} are for functional blocks; do…end for procedural blocks.
That shows me which expressions are important for their results, and which
are not.
Gavin
This sounds very interesting. Can you expand upon this a little?
What do you take as the difference between procedural blocks and
funcitonal blocks? Can you provide an example?
Vim can match do/end blocks, and folding is already done by it.
-austin
···
On Thu, 31 Jul 2003 01:37:46 +0900, Garance A Drosihn wrote:
At 12:29 PM +0900 7/30/03, Aredridel wrote:
The one nice thing about brackets is that editors know how to match them
up. Ie, I can select a section of code by just double-clicking on the
initial or ending bracket.
A programmer’s feeling is important to him/herself… It does not mean
that PHP is bad because I think it is bad
I don’t know any PHP debugger. I write A LITTLE php directly on Apache
and debug in IE.
Your reason defending the ; is not well established Please note ruby
also support ; if you want to write multiple lines of code on one line.
Javascript also support OPTIONAL ;
So it is better on this regard. By the way, I have never seen a
programmer who write code in Microsoft Word, so, the statement that a “;”
is usuful to the program that it will “survive a word processor” sounds
strange to me.
I have used PHP… it is Sh*t… mainly because of the “;”. A lot of
Have you used a PHP debugger? Or do you just click the refresh button in
Mozilla? You cant say a language is s**h just because you use ; . In PHP
the ; is very useful eg.
My solution is to use {} for one line blocks and do…end for more
complicated things.
I tried this style for a while. But then every time I added lines
to a
one-line block, I had to change {} to do/end.
Today I normally used {} on all blocks, except in Rake files.
My take is: {} are for functional blocks; do…end for procedural
blocks.
That shows me which expressions are important for their results, and
which
are not.
Gavin
This sounds very interesting. Can you expand upon this a little?
What do you take as the difference between procedural blocks and
funcitonal blocks? Can you provide an example?
I guess he means
(0…10).each do |i|; puts i; end
(0…10).map {|i| i+i}
So it is better on this regard. By the way, I have never seen a
programmer who write code in Microsoft Word, so, the statement that a “;”
is usuful to the program that it will “survive a word processor” sounds
strange to me.
maybe there is a code snippet somewhere at the home of a programmer and
his/her non programming wife/husband sends you the snipped pasted in a
html email or pasted into word as attachment?
Isn’t independence of white space treatment also an argument for
SGML, XML?
Of course IMO it can be masochistic to program/write in space ignoring
languages (i.e. XSL).
···
–
Fritz Heinrichmeyer FernUniversitaet, LG ES, 58084 Hagen (Germany)
tel:+49 2331/987-1166 fax:987-355
Precisely. Some blocks are called to do something, and some are
called to evaluate to something (or, to return something). That’s
a high-level difference that is important to understanding high-level
program flow, so providing a visual signal in the code is some help to
me.
It turns out that most functional blocks are one-liners, like:
set.find { |e| e.satisfies condition }
But then you get some larger ones:
set.map { |e|
if something
e.x
else
e.y
end
}
do…end looks silly on one line, though, so I always spread that out:
people.each do |p|
process(p)
end
I figure the concept there is worth devoting three lines to.
Cheers,
Gavin
···
On Thursday, July 31, 2003, 8:58:48 PM, Robert wrote:
My solution is to use {} for one line blocks and do…end for more
complicated things.
I tried this style for a while. But then every time I added lines
to a
one-line block, I had to change {} to do/end.
Today I normally used {} on all blocks, except in Rake files.
My take is: {} are for functional blocks; do…end for procedural
blocks.
That shows me which expressions are important for their results, and
which
are not.
Gavin
This sounds very interesting. Can you expand upon this a little?
What do you take as the difference between procedural blocks and
funcitonal blocks? Can you provide an example?
I guess he means
(0…10).each do |i|; puts i; end
(0…10).map {|i| i+i}
My solution is to use {} for one line blocks and do…end for
more
complicated things.
I tried this style for a while. But then every time I added
lines
to a
one-line block, I had to change {} to do/end.
Today I normally used {} on all blocks, except in Rake files.
My take is: {} are for functional blocks; do…end for procedural
blocks.
That shows me which expressions are important for their results,
and
which
are not.
Gavin
This sounds very interesting. Can you expand upon this a little?
What do you take as the difference between procedural blocks and
funcitonal blocks? Can you provide an example?
I guess he means
(0…10).each do |i|; puts i; end
(0…10).map {|i| i+i}
robert
Precisely. Some blocks are called to do something, and some are
called to evaluate to something (or, to return something). That’s
a high-level difference that is important to understanding high-level
program flow, so providing a visual signal in the code is some help to
me.
It turns out that most functional blocks are one-liners, like:
Interestingly we seem to reach approximately the same formatting because
of different reasons.
The ternary operator is idiomatic of expert (or expert-wannabe) use
of the C family of languages and likely to confuse and even scare away
novice Ruby users who aren’t from that segment of the population, or
only have limited experience with C.
Chris
···
On Thursday, July 31, 2003, at 5:40 PM, Gavin Sinclair wrote:
The ternary operator is idiomatic of expert (or expert-wannabe) use
of the C family of languages and likely to confuse and even scare away
novice Ruby users who aren’t from that segment of the population, or
only have limited experience with C.
That’s possibly true. I faintly remember the times when I first saw ?:
and wondered what that might be. Nowadays I’ve become so acquainted with
this idom that I hardly notice this as something strange. Thanks for
reminding me!
The ternary operator is idiomatic of expert (or expert-wannabe) use
of the C family of languages and likely to confuse and even scare away
novice Ruby users who aren’t from that segment of the population, or
only have limited experience with C.
The ternary operator is useful, as evidenced by the fact that people
use it when equivalents exist.
???
Violence is useful, as evidenced by the fact that people
use it when equivalents exist.
???
Correct. The question is if being useful makes it acceptable. Some
people believe that a goal can justify any means while others believe
that this is not true.
I am pretty sure that there is an equivalent of German ‘Der Zweck
heiligt die Mittel’ in many languages…
Gis,
Josef ‘Jupp’ Schugt
···
On Fri, Aug 01, 2003 at 07:48:54PM +0900, Martin DeMello wrote:
–
N’attribuez jamais à la malice ce que l’incompétence explique !
– Napoléon
I disagree with it, believing that the means can corrupt the end.
-austin
···
On Sat, 2 Aug 2003 05:09:39 +0900, Josef ‘Jupp’ Schugt wrote:
Saluton!
Marko Schulz; 2003-08-01, 12:37 UTC:
On Fri, Aug 01, 2003 at 07:48:54PM +0900, Martin DeMello wrote:
The ternary operator is useful, as evidenced by the fact that
people use it when equivalents exist.
Violence is useful, as evidenced by the fact that people use it when
equivalents exist. ???
Correct. The question is if being useful makes it acceptable. Some people
believe that a goal can justify any means while others believe that this
is not true.
I am pretty sure that there is an equivalent of German ‘Der Zweck heiligt
die Mittel’ in many languages…
Violence is useful, as evidenced by the fact that people use it when
equivalents exist. ???
Correct. The question is if being useful makes it acceptable. Some people
believe that a goal can justify any means while others believe that this
is not true.
I am pretty sure that there is an equivalent of German ‘Der Zweck heiligt
die Mittel’ in many languages…
“The End Justifies the Means”, in English.
I disagree with it, believing that the means can corrupt the end.
Obviously even the UN Security Council does not share your (and mine)
opinion. They guarantee that a well-known country’s troops may commit
any crime of war without being punished for it by the international
community. I don’t think that they are going to commit such crimes
but that does not change the ethical implications of the decision.
Gis,
Josef ‘Jupp’ Schugt
···
–
N’attribuez jamais à la malice ce que l’incompétence explique !
– Napoléon