Given that we've been over the rename(2) behaviour-copying and so on, I thought I'd hijack part of this thread for a more abstract discussion:

What's better, familiar behaviour or intuitive behaviour?

I first came across this argument in Maguire's Writing Solid Code book. His example (and mine) was a wrapper for C's malloc(3) and friends, for instance, to detect memory leaks. You can call stdlib realloc with a NULL pointer, in which case it acts like malloc, or with a zero size, in which case it acts like free. Maguire argues that in almost every case, NULL-pointer or zero-size calls to realloc are errors rather than clever tricks. Accordingly, he removed this behaviour from his realloc wrapper. I did the same when I wrote a realloc wrapper, for the same reasons.

In general, I tend to think that duplicating broken behaviour in the interests of familiarity is a bad idea. The question, then, becomes: "Is rename's behaviour broken, or just unexpected?"

--
F o x t r o t U n i f o r m
Found a typo in this node? /msg me
% man 3 strfry


In reply to Re: A DWIM too far? by FoxtrotUniform
in thread A DWIM too far? by BrowserUk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.