So if you follow eliot suggestion

methodDeclaration
   [ methodbody ]

put the start in another line.

because with

methodDeclaration [
   methodbody ]

we do not identify the body as a rectangle

I do not think that [ on the first line is a good idea.

Remember that people will send code in email and that one day one guy
(me) will extend the code browser and change my books.


Stef



On Mon, Sep 11, 2017 at 7:25 AM, Stephane Ducasse
<[email protected]> wrote:
> Yes and this is not really good for method with multiple and long
> selectors because you have to spot the end of the line
>
> Morph class>>obtainArrowheadFor: aPrompt defaultValue: defaultPoint [
>     "Allow the user to supply a point to serve as an arrowhead size.
> Answer nil if we fail to get a good point"
>     | result |
>     result := UIManager default request: aPrompt initialAnswer:
> defaultPoint asString.
>     result isEmptyOrNil ifTrue: [^ nil].
>     ^ [(Point readFrom: result readStream)] on: Error do: [:ex | nil].]
>
> vs.
>
> Morph class>>obtainArrowheadFor: aPrompt defaultValue: defaultPoint
>     [
>     "Allow the user to supply a point to serve as an arrowhead size.
> Answer nil     if we fail to get a good point"
>     | result |
>     result := UIManager default request: aPrompt initialAnswer:
> defaultPoint asString.
>     result isEmptyOrNil ifTrue: [^ nil].
>     ^ [(Point readFrom: result readStream)] on: Error do: [:ex | nil].
>     ]
>
>
> On Sun, Sep 10, 2017 at 6:51 PM, Esteban Lorenzano <[email protected]> 
> wrote:
>> heh… the format I propose is like this:
>>
>> methodDeclaration [
>>   methodbody
>> ]
>>
>> I think that keeps good readability and I can parse it easily.
>>
>>> On 10 Sep 2017, at 18:23, Stephane Ducasse <[email protected]> wrote:
>>>
>>> Hi esteban
>>> for me having space around [ ] improves readibility.
>>> I preferred
>>>
>>> methodDeclaration
>>>   [
>>>   methodbody
>>>   ]
>>>
>>> over
>>>
>>> methodDeclaration
>>>   [ methodbody ]
>>>
>>> Especially in case of method body is blockish like while true/exception.
>>>
>>> But this is ok if people prefer
>>>
>>> methodDeclaration
>>>   [ methodbody ]
>>>
>>>
>>> Now I do not like
>>>
>>> methodDeclaration [
>>>   methodbody ]
>>>
>>> Stef
>>>
>>> On Sun, Sep 10, 2017 at 10:25 AM, Esteban Lorenzano <[email protected]> 
>>> wrote:
>>>>
>>>> On 9 Sep 2017, at 19:35, Eliot Miranda <[email protected]> wrote:
>>>>
>>>>
>>>> Point class >> x: anInt1 y: anInt2
>>>>  [
>>>>    ^ self new setX: anInt1 Y: anInt2]
>>>>
>>>> because trailing white space will only accumulate, something I see in Pharo
>>>> and Squeak code.
>>>>
>>>> Alternatively have the output add white space if required and the input
>>>> remove any and all trailing white space.
>>>>
>>>>
>>>> in fact, I’m working to remove the extra trailings this format can add. The
>>>> idea is that parsed text == original text. Then, originally my format was
>>>>
>>>> methodDeclaration [
>>>> methodBody
>>>> ]
>>>>
>>>> but now I’m digging also into
>>>>
>>>> methodDeclaration [
>>>> methodBody ]
>>>>
>>>> (always keeping the identity of sources idea)
>>>>
>>>> cheers!
>>>> Esteban
>>>>
>>>
>>
>>

Reply via email to