[Issue 11365] Allow D source file names to have no extension (or an arbitrary extension)
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Oct 31 12:09:01 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11365
--- Comment #15 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2013-10-31 12:08:58 PDT ---
(In reply to comment #12)
> Why should we enforce this ? We enforce things to prevent obvious mistakes. D
> language plays well in this field. It ensures what it is sure needs to be
> ensured, and give you the tools to build your own rules, with the least
> burdens.
>
> It's not a mistake to have a source file with an arbitrary extension, or no
> extension at all. DMD will still now it's argument is a source file, whatever
> its name is.
That's not true. It can't have a .lib extension, or an .obj/.o extension.
Arbitrary extensions means import switches will not work, the compiler won't
know which files it has to inspect to find D code. So this feature will be
useful for scripts and in cases where you're explicitly passing all files to
DMD.
(In reply to comment #10)
> As I have already mentioned in NG, the very idea that file extension should
> have any relation with its content is just plain wrong and needs to be
> discouraged, as well as any arbitrary limitations that may impose.
That's exactly what happens when you allow arbitrary extensions, tools end up
inventing their own semantics *based on* the extension:
http://gcc.gnu.org/onlinedocs/gcc-4.8.2/gcc/Overall-Options.html:
file.c
C source code that must be preprocessed.
file.i
C source code that should not be preprocessed.
file.ii
C++ source code that should not be preprocessed.
file.tcc
C++ header file to be turned into a precompiled header or Ada spec.
See what I mean?
If it's only .d/.di and for [1] extensionless files we allow then we make
everything simple.
> In other words, it is not a as much of a problem of DMD codebase that is uses
> ".c" for C++ code, it is a problem of IDE's/tools that assume it is a C code
> without providing any convenient way to override that assumption.
So now every tool in existence has to do heuristics on text files? The benefit
of having known and defined extensions is to make it easier to figure out what
a file is without having to open it, to make it easier to filter through a
directory of files and organize them based on their extension.
Using .c for C++ files is Walter's fault and nobody else's. There are no
excuses here.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list