April 2017

S M T W T F S
      1
2345678
910111213 1415
16171819 2021 22
23242526272829
30      

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Thursday, January 31st, 2008 04:28 pm

I just want to mention, for the record, that I hate filename extensions on anything with the executable bit set. Yes, I'm looking at you, authors of Perl and Python scripts.

When I'm at the command-line and want to run a command (say, "todo"), I want to type "todo" and have it work. I don't want to have to type "todo.pl", nor do I want to have to type "todo<TAB>" to get my shell to do it for me. I shouldn't have to know, or care, or even be reminded of what scripting language the script I'm invoking was written in. Isn't the entire point of the "she-bang" magic line available in all modern shells that you can run a script without having to know what kind of script it is?

Can anybody give me a single good reason we keep tacking all this ugly garbage onto the end of our scripts? It's not like editors can't use that same first line to figure out what kind of script it is and turn on appropriate syntax features. (I'm sorry, it's 2008. If your editor can't handle that, what's wrong with your editor?)

So why is my world filled with "todo.pl" and "moap.py" and "generate.sh" (in all probability requiring bash, no less)? Will you all just cut it out? I'm sick of having to symlink and alias around your annoying naming conventions.

Tags:
Thursday, January 31st, 2008 10:03 pm (UTC)
I'd say it's because with any interpreted language you're combining two roles - the source code and the program.

To the person running the program, no, you don't care what sort of file it is. To the machine running the program, it doesn't care what the extension is as long as it has the first line set out properly. But to the coder, it's really useful to know what format it is.

"Ah, but you should know what language you're coding in anyway! It's not like you're using three languages in the same project."

Well, no. But I might have several types of file still. I might have some ruby files, some yaml config files, some plaintext reference files, maybe some pictures. Suddenly having .rb or .py or .sh on the end of my file is useful, because I can see which are code files.

Yeah, I know, all these files should be segregated by folder anyway. Sometimes you can't do that.

Anyway, it's OK with compiled languages. I can have all my files named .c and .h, and when I compile it I get something that's extensionless. That's because the source and the program are separated. No such luck with interpreted stuff.

And some people take your opinion. I've seen plenty of ruby setup packages where the main file is just configure or setup. And I've renamed my own stuff to remove the .rb or whatever once I'm using it from the command line.
Thursday, January 31st, 2008 11:38 pm (UTC)
a) Yup, a point I didn't bring up because it weakened my argument :P. However I feel there's a certain ingrained feeling among geeks that no extension -> binary file. Not necessarily true - c.f. makefiles, readmes.

b) The thing being there that you're suggesting what is essentially a two-step process - open the file, check the header - vs. a one-step - check the file extension. And geeks are lazy.

c) Yeah, the problem (I think) goes right back to compiled/interpreted. Most stuff I stick in ~/bin I remove the extension from (for exactly the reasons you find - I really hate reaching for the . key when I'm typing a filename), about the same time I chmod a+x. But there still isn't that nice clear-cut boundary between coding and using.