[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: OT - trivial programming language



"Derrick 'dman' Hudson" <dman@dman13.dyndns.org> writes:

> On Wed, May 26, 2004 at 07:21:38PM +0000, Faheem Mitha wrote:
>
> | On the other hand, indentation is easily lost
> | information, for example when cutting and pasting.
>
> In practice this isn't a problem.  Cut and paste the entire block of
> code and the indentation is preserved.

What happens when, after moving a block, it is surrounded by more or
less levels of conditionals or loops?  I don't program Python, so I
don't know.

Given the following pseudo code:

if (...) {
    a;
    b;
}

I can paste some lines in the middle of this easily:

if (...) {
    a;
d;
e;
    b;
}

Then I tell my editor to reindent the whole thing and Bob's my uncle.

But if I do the analogous thing in Python, the d line ends the
conditional...

But I'm sure that Python programmers don't have this kind of problem,
so there must be something I'm not seeing.

> Besides, you shouldn't try using the "copy-n-paste" method of code
> reuse because it doesn't work in the long run.

I guess cut and paste (as opposed to copy and paste) is not a problem.
Surely moving code around is something that happens often during
refactoring, and refactoring has become something of a fad recently.

Also, I find it interesting that RMS is not opposed to duplication of
code.  Given the results, his position can't be all that stupid.  Of
course, this contradicts with the teaching we all got in school, where
they told us that duplicating code leads us to programmer's hell.  I'm
still trying to figure out where this contradiction comes from and how
to resolve it.

Kai



Reply to: