[REBOL] Re: source code layout question
From: ammonjohnson:ya:hoo at: 4-Jan-2002 18:14
Carl Read wrote:
>On 05-Jan-02, Joel Neely wrote:
>
>> foo: func
>> [ "Computes a Euclid string for numeric data"
>> x [integer!] "major argument"
>> y [integer!] "corporal argument"
>> z [integer!] "seed string, modified by evaluation"
>> ][ either x = 0
>> [ z]
>> [ either y = 0
>> [ head reverse z]
>> [ while [x < y]
>> [ y: y - x
>> append z "x"
>> ]
>> foo y x z
>> ] ] ]
>>
>
>I rather like that, in that the relationship between the opening and
>closing brackets is much easier to see than with conventional styles,
>it creating obvious vertical lines. It's only drawbacks I think are
>three extra spaces on some lines (minor) and not being able to cut
>and paste it into the Console - a major disadvantage, I think. If
>it wasn't for that, it'd be tempting to switch to it. And when
>there's no nesting, the code becomes very clear...
>
I will draw the line just a little closer to the middle:
foo: func [
"Computes a Euclid string for numeric data"
x [integer!] "major argument"
y [integer!] "corporal argument"
z [integer!] "seed string, modified by evaluation"
][
either x = 0 [z][
either y = 0 [head reverse z][
while [x < y][
y: y - x
append z "x"
]
foo y x z
] ] ]
Have the brackets begin on end of the line, but stack them at the end.
This will include the readability on the end while mantaining the
ability to cut & paste! I like, & I am convinced to switch. ;-)
Enjoy!!
Ammon