Lo que sigue me recuerda algo que vengo pidiendo desde la decada pasada a
los alumnos (y todos los que se consideren principiantes y quieran aportar
ALGO)
Un pequeño informe intitulado con el intrigante titulo
Donde termina una linea de texto ?
Algo que muchos que solo ha usado Windows ignora ...
Y que en algún momento traera problemas.
Mismo para las codificaciones, lease UTF-8, ISO-8859-1 , etc
------ Forwarded Message
From: Igor Stasenko <
[hidden email]>
Reply-To: The general-purpose Squeak developers list
<
[hidden email]>
Date: Tue, 12 Jan 2010 12:40:48 +0200
To: The general-purpose Squeak developers list
<
[hidden email]>
Subject: Re: [squeak-dev] Re: New trunk server
2010/1/12 Levente Uzonyi <
[hidden email]>:
> On Tue, 12 Jan 2010, Igor Stasenko wrote:
>
>> 2010/1/12 Levente Uzonyi <
[hidden email]>:
>>>
>>> On Tue, 12 Jan 2010, Igor Stasenko wrote:
>>>
>>>> 2010/1/12 Levente Uzonyi <
[hidden email]>:
>>>>>
>>>>> On Mon, 11 Jan 2010, Nicolas Cellier wrote:
>>>>>
>>>>>> Hi Levente,
>>>>>> what about completely ignoring line endings in diffs ?
>>>>>>
>>>>>
>>>>> I intentionally added this feature. Do you think it's wrong?
>>>>>
>>>>>
>>>> IMO empty lines (and white space in general), is not an informal part
>>>> of source code,
>>>> so diffing them makes not much sense.
>>>
>>> Imagine that you removed lf characters from the code or you accidentally
>>> added some linefeeds while pasting code from and external source. The
>>> diff
>>> shows no changes. Is that OK?
>>>
>>
>> If the new lines is informal part of source code, i.e. belong to the
>> string literal:
>>
>> foo := '1
>> 2
>> 3
>>
>> 4
>> '.
>>
>> Then we should care. Otherwise not.
>
> I care and we should. Newlines make a difference. I don't want to decode one
> liners like:
>
> at: key put: anObject | index assoc | index := self scanFor: key. assoc :=
> array at: index. assoc ifNil: [self atNewIndex: index put: (Association key:
> key value: anObject)] ifNotNil: [assoc value: anObject]. ^anObject
>
> It's much easier to read this one:
>
> at: key put: anObject
>
> | index assoc |
> index := self scanFor: key.
> assoc := array at: index.
> assoc
> ifNil: [ self atNewIndex: index put: (Association key: key value:
> anObject) ]
> ifNotNil: [ assoc value: anObject ].
> ^anObject
>
> For me, every whitespace counts in the above method, but the original
> question was not this, but:
> Should the diff algorithm care about the line endings or not?
> Are these three lines identical or not (in a diff):
> foo bar<cr><lf>
> foo bar<cr>
> foo bar<lf>
>
No. Please, not again. :) All of them should be treated equally. We're
talking here about source code,
not about binary files.
>
> Levente
>
--
Best regards,
Igor Stasenko AKA sig.
------ End of Forwarded Message