On Mon, Sep 6, 2010 at 3:15 PM, Kay Hayen <[email protected]> wrote: > Hello Stefan, > >>> That other topic, of C string literals seems like solving a problem that >>> shouldn't exist. Why should the Python code use unicode literals and the >>> C code not, that is just incompatible to Python. >> >> I don't think I understand what you are trying to say here. We are talking >> about the interpretation of string literals *in Cython code* here. C code >> doesn't know about Unicode, it only knows about char*, i.e. byte sequences. >> It doesn't matter that there are types like "wchar_t" when you actually >> need to talk to something that wants a char*. Did you actually read the >> entire thread? > > I surely read it entirely and with big interest. With my own compiler > project Nuitka, I came across the issue too. And I have on my mind to do > it that way, to keep the unicode or non-unicode nature of strings to > follow the Python strings at hand. I may be misunderstanding people > because of my different goal to stay close to CPython. > > I am coming from a standpoint where the Python semantics should be the > Cython semantics. So naturally I suggest that Cython string literals are > to be Python string literals and that there be no C literals, but > instead only Python literals in the source code. > > Then allow users to cast or convert "pchar_t *" to "char *" which > depending on the value of "unicode_literals" may or may not be trivial, > making the C code portable if wanted, and to only do the conversion if > necessary. > > I don't see any use having some of the proposed hybrid semantics > somewhere between C, Python 2 and Python 3 literals, which is just > another step to being neither C nor Python. > > Regarding C and unicode: While true that C doesn't have it, but I would > be hardpressed to find a compiler that doesn't at least have types for > it. Otherwise CPython probably would itself have a hard time to support > unicode.
The key point, and the reason this comes up, is that we care about natively calling existing C libraries that take char* arguments. - Robert _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
