Re: "~" vs. "POSIX file"
Re: "~" vs. "POSIX file"
- Subject: Re: "~" vs. "POSIX file"
- From: "Mark J. Reed" <email@hidden>
- Date: Wed, 25 Oct 2006 02:09:16 -0400
Me> #!/usr/bin/tclsh
Me> file open "~/foo.txt"
Me> # works if "foo.txt" exists in the home directory
Philip>This example doesn't work at all. It's illegal.
Simple typo. Replace "file open" with plain "open". My point remains.
P> Ok, I see a photo of Mark J. Reed on the internet. A shot of him and
P> his nephews and nieces snuggled together on grandma's sofa at the
P> family reunion. And somewhere else on the internet someone puts:
P> "Mark J. Reed, apparent pedophile" as a caption above the photo. They
P> chose their words carefully didn't they?
Wow. Here I thought I was being downright civil, and this is what you
come up with? I'm tempted to invoke Godwin's Law here, but I'll
refrain. I mean, I know that Tcl is a highly orthogonal language, and
consistency is a virtue prized by its adherents, but I hope you don't
honestly assign the same degree of value judgement to the words
"inconsistency" and "pedophile". I, personally, have definitely
exhibited inconsistency, on multiple occasions, and will no doubt do
so again. I do try not to be inconsistent, but a failure in that
regard is not exactly anywhere near the "I'd sooner kill myself"
category.
Yeesh.
Anyway. My saying that the behavior of tclsh includes an "apparent
inconsistency" was not in any way intended to be an attack on tclsh.
Every single programming language mentioned in this thread has
apparent inconsistencies. Most no doubt have some genuine
inconsistencies as well.
I have repeatedly attempted to avoid getting into any "my language is
better than your language" wars while simply trying to clarify the
differences in behavior among the various alternatives. I'm,
obviously, not above teasing you for being so fond of Tcl, or teasing
certain other unnamed list members for being equally fond of Python,
but it is 100% good-natured teasing on my part, meant only in jest.
No, Tcl isn't my language of choice; if it were, I wouldn't have made
the dumb mistake of typing "file open" when I meant "open". I happen
to disagree with some of the design decisions behind it, and find that
I'm more comfortable using Ruby or Perl. But that's a personal choice
that I'm not going to drag into a discussion of the technical merits
of a solution to an AppleScript problem.
I'm operating from the presumption that the subscribers of this list
are used to the somewhat more unified world of AppleScript and
AppleEvents rather than the wide variety of UNIX scripting languages.
Since my experience has been exactly the reverse, I share these little
tidbits in the hope that someone will find them useful. It's my
attempt to reciprocate in some small manner for the large quantity of
valuable AppleScript information I've received over the past couple
years as a subscriber to this list.
And on those occasions when I have opposed the introduction of tclsh
into a solution set, it's not because I don't like Tcl. I would
oppose the introduction of bash or perl or python or ruby into those
same solutions, because the addition of ANY extra language doesn't, in
my opinion and considering the specific problem at hand, help things
along enough to warrant the added complexity/overhead.
So please, next time you perceive a value judgement in one of my
statements about a language feature, at least consider the possibility
that it is being inserted by you rather than intended by me.
To return to the apparent inconsistency at hand:
In tclsh, which is as stated in my previous message a genuine command
shell because of the fallback to exec, you can test for the existence
of a file named "~/foo.txt", get a true result, pass that same
filename string to a shell command, and then get a result indicating
that the file doesn't exist. No, it's not a bug in Tcl. Yes, it is
completely consistent with the way tclsh is defined to work. It
nevertheless *looks* inconsistent to the uninitiated.
It is, furthermore, an idiosyncracy of tclsh; it doesn't happen in
bash (the file will be found) or in Perl (the initial existence test
will return false). That's why I thought it worth mentioning. I
wasn't saying "Looky here! Yet another flaw in that sucky language
Tcl I hate so much!" I was saying "Here's a behavior pattern unique
to Tcl that might surprise you if you're new to the language."
So, if I may be forgiven for repeating myself, please do chill. If
you want to explore any of this in more detail offlist, I'll be happy
to do so. (But I'm not trying to have the last word, either; if you
feel I have mischaracterized something and want to reply on-list, by
all means do so. I just fear this little sidebar may have already
exhausted the patience of the readership.)
--
Mark J. Reed <email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/mailman//archives/applescript-users
This email sent to email@hidden