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.

See for example: 
http://www.gnu.org/s/libc/manual/html_node/Extended-Char-Intro.html

I am not so sure, how CPython's UCS2 vs. UCS4 usage comes into play 
here, I just hope it's the compiler / platform standard, however big 
wchar_t is.

Yours,
Kay
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to