[Issue 13512] dmd cannot compile perfectly valid code with shebang

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Sep 22 04:04:39 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=13512

--- Comment #9 from Sobirari Muhomori <dfj1esp02 at sneakemail.com> ---
(In reply to Ketmar Dark from comment #7)
> (In reply to Sobirari Muhomori from comment #6)
> > AFAIK, the standard text encoding on posix today is utf-8
> oh, and for what reason we have that strange "locale settings" then?

AFAIK, locale defines time, number formats and user language for localization.
It's orthogonal to text encoding.

> also, can you point me at the exact standard part which tells that text encoding
> is utf-8 regardless to current locale settings?

posix is not very strict with standardization, it only roughly describes what
can be done and how. After all, it's not really a standard, but just written
down de facto conventions, which established some other way.

> > Shebang is sort of brittle by design. It works only for text files
> WUT?! O_O it works perfectly for *any* type of file.

If it would work perfectly for any type of file, you wouldn't report this
problem in the first place as everything would just work.

> it's completely ok to
> place binary data after shebang if interpreter can cope with that.

Binary data formats are not that flexible. And if interpreter is sufficiently
smart, it can cope with various text encodings too.

> > and if the text file encoding matches that of your system.
> and the given example matches. yet dmd refuses to compile my sample. not
> *run*, but *compile*.

utf-8 matches koi8 only in ascii range. If you use only ascii, it should work.

> the right shebang support in dmd must be like this: check if the first chars
> of the file forms shebang, and if they are, then just skipping other chars
> until '\n'. and skip '\n'. that's all. no validation. no martian logic. just
> skipping chars.

D source is a text file, and text files have single encoding. Having variable
encoding contradicts usual logic of text files.

--


More information about the Digitalmars-d-bugs mailing list