On 5/1/07, Smylers <[EMAIL PROTECTED]> wrote:
What are the situations in which a programmer really needs to open something but doesn't know wether that thing is a file, a directory, or a URL? I'm still unpersuaded this is sensible default behaviour.
Lots of times. It's an agnosticism, meaning that you can write a module which opens things and it doesn't have to know what it's opening; as a matter of fact, it doesn't even have to know what kinds of things it's *capable* of opening. That's powerful. The point is, even though opening a file and opening a URL are reasonably different things, they are both the same logical operation, so they can be abstracted. Not abstracting them will either cause modules to have to take a "type of file" parameter whenever they take a file, or will lead to code like this: my $fh = do given $file { when /<url>/ { openurl($file) } default { open($file) } } And the programmer of this module may not have been aware that he could operate on directories, even though it's just some sort of line processing module. Anyway, my point is that the concept of opening something is abstractable, and not abstracting it means that everyone has to abstract it separately. And please don't argue from the standpoint of security holes. Security holes are possible in every language which talks to the outside world. Taint mode is a pretty good way to keep security holes out of a complex, rich language like Perl. But if you really want to be free of security holes, you either have to make a language which doesn't do anything, or make a language in which everyone can be an expert within an hour. Luke