Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^2: Why isn't there a "copy" function?

by Eyck (Priest)
on Sep 10, 2004 at 06:24 UTC ( [id://389973]=note: print w/replies, xml ) Need Help??


in reply to Re: Why isn't there a "copy" function?
in thread Why isn't there a "copy" function?

Perl IS portable Unix, that is it's strength and personality. (btw this recent flurry of windows programmers without unixy background using perl seems to confirm how strong and usefull this design philosophy is).

So this is rather - why doesn't Un*x have 'filecopy' syscall? Because it's not that common operation, when you work on something you move it, rename it, modify it AND archive it.

'copy' syscall would be usefull for archiving... or would it?

Besides, unix way is to be ascetic and elegant, avoiding putting messy and slow algorithms under the hood, and filecopy is definitely slow ( you want syscall with fast filecopy - great, here's hardlink for you ).

That is also a reason why rename fails across filesystems, it would be possible to have 'rename' call that works in such conditions ( look at the source of 'mv' command, such non-unix 'complete' design would put all that source into system, this would also add non-determinism to syscalls - normal rename returns very fast, across filesystems rename would take forever )

It seems like you don't appreciate that?

  • Comment on Re^2: Why isn't there a "copy" function?

Replies are listed 'Best First'.
Re^3: Why isn't there a "copy" function?
by mhi (Friar) on Sep 10, 2004 at 07:08 UTC
    If I'm not mistaken, in the early days mv was _not_ able to move a file across file system boundaries, because it only implemented a rename. In those days you had to copy the file to the target FS and afterwards rm the leftovers on the source FS. Yes, you could call that ascetic. :-)
      Actually I got burned few times by this new 'mv' behaviour, you mv something from one dir to another, and suddenly it starts copying without warning.

      This is very bad behaviour, this hurts ALOT when you're moving 1G file and there's only 700Megs left free on your partition.

      (especially when you're moving between mount -o bind'ed directory on the same filesystem and mv thinks these are two different filesystems)

Re^3: Why isn't there a "copy" function?
by hardburn (Abbot) on Sep 10, 2004 at 12:46 UTC

    It seems like you don't appreciate that?

    Huh? What makes you draw that conclusion? I don't want a lot of this stuff in the core simply because I'd like the core to be as minimilistic as possible (for one thing, it would encourage new programmers to use modules). It's too late for Perl5, but I can dream, can't I?

    "There is no shame in being self-taught, only in not trying to learn in the first place." -- Atrus, Myst: The Book of D'ni.

      I don't want a lot of this stuff in the core simply because I'd like the core to be as minimilistic as possible (for one thing, it would encourage new programmers to use modules). It's too late for Perl5, but I can dream, can't I? Well, there's always Python, where you can't do a lot without including at least one module. And then there's C where you can't even do I/O without the help of a library. I love a language where I don't have to remember in which module which function was defined so I can use.

      As for your reason, "to encourage new programmers to use modules", most people are interested in getting more people to program Perl by making it easier for new programmers. It seems you have a different view.

        Well, there's always Python, where you can't do a lot without including at least one module. And then there's C where you can't even do I/O without the help of a library.

        I don't think it's that awful. It's one line of code per library. Besides, operations like copy and rename aren't that common in Perl.

        . . . most people are interested in getting more people to program Perl by making it easier for new programmers.

        Yes, I do have a different view. Perl has gone too far into wizard territory to be good for new programmers. I would never recommend Perl as a first language (Python and Ruby, OTOH, and great for this purpose). The same things that make it so great for experianced programmers are what make it so difficult for novices.

        "There is no shame in being self-taught, only in not trying to learn in the first place." -- Atrus, Myst: The Book of D'ni.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://389973]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-04-18 18:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found