----- Original Message -----
From: "Bob X" <bobx / linuxmail.org>
Newsgroups: comp.lang.ruby
To: "ruby-talk ML" <ruby-talk / ruby-lang.org>
Sent: Thursday, July 18, 2002 4:30 PM
Subject: Re: Just a small language question...


> Rich Kilmer wrote:
> > Because the package name represents a file name which could have spaces,
> > etc.
>
> Er...well Python and Perl (and I think Tcl) do not seem to have this
worry?
>

Hmm. Let's back up here.

require takes a file name. In my book, that's
data. Leave it unquoted, and it looks like a
variable name or something.

Blank spaces are not the entire issue. Even if
we disallowed spaces in names, how would you
distinguish between the file name and some other
kind of expression?

Contrived example (I'm good at those sometimes).
In Ruby, both these are valid:

  class Blah
    attr_accessor :txt
  end

  file = Blah.new
  file.name = "foo.bar"

  require "file.txt"    # Read from "file.txt"
  require file.txt      # Read from "foo.bar"

As for automagically converting an identifier or
expression into a string... I'd be surprised if
Python did it. Less surprised if Perl did. Not
much surprised if Tcl did -- seems like every
bloody thing in the universe is a string in Tcl,
isn't it?

Anyhow, I wouldn't *want* this to work. It would
just be too weird. Next thing, somebody would want
'open' to work the same way:

  file = File.open(myfile.txt)

<tongue_in_cheek>
Unquoted file names work in DOS batch files.
That's because they quote the variable names
instead. And it probably would have worked in
Palo Alto BASIC, circa 1978, which had perhaps
the worst string handling since machine language
was king.
</tongue_in_cheek>

Hal

went out