help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [OFFTOPIC] Re: Invoking a function from a list of functions


From: Rusi
Subject: Re: [OFFTOPIC] Re: Invoking a function from a list of functions
Date: Wed, 28 Nov 2018 21:37:15 -0800 (PST)
User-agent: G2/1.0

On Thursday, November 29, 2018 at 12:38:49 AM UTC+5:30, Yuri Khan wrote:

> (I was recently informed that web browsers allow the use of
> compatibility characters in domain names, and compatibility-decompose
> them before resolving, so U+338F “kilogram” becomes Kyrgyzstan and
> milliliter maps to Mali.

I am being troublesome but (hopefully!) not malicious
Add some good ol badness as hot peppers to the cake
https://en.wikipedia.org/wiki/IDN_homograph_attack

> That *is* madness.)

Precisely my point

On Thursday, November 29, 2018 at 12:27:46 AM UTC+5:30, Eli Zaretskii wrote:
> > From: Yuri Khan 
> > 
> > > That's debatable: the Unicode Standard says to act according to
> > > canonical equivalence only in text, whereas the above are symbol
> > > names.  We do display them the same (if the font supports that), but
> > > we aren't under any obligation to map them to the same symbols, IMO.
> > 
> > Standard Annex 31 deals with identifiers in programming languages, and
> > recommends considering identifiers equivalent if they are the same
> > under Normalization Form C for case-sensitive languages (such as
> > Python and Elisp).
> 
>   "Implementations that take normalization and case into account have
>   two choices: to treat variants as equivalent, or to disallow
>   variants."
> 
> So there's a choice.

And if you ask me, disallow is the reasonable default
Earlier I compared python3 and elisp — a nuanced comparison
A more basic comparison would be between python 2 and 3 


$ cat simple.py 
A = 1
A = 2
print("A, A, A==A : %s, %s, %s\n" % (A,A,A==A))


$ cat homoglyph.py 
A = 1
А = 2
print("A, А, A==А : %s, %s, %s\n" % (A,А,A==А))

$ python2 simple.py 
A, A, A==A : 2, 2, True

$ python3 simple.py 
A, A, A==A : 2, 2, True

$ python3 homoglyph.py 
A, А, A==А : 1, 2, False

$ python2 homoglyph.py 
  File "homoglyph.py", line 2
SyntaxError: Non-ASCII character '\xd0' in file homoglyph.py on line 2, but no 
encoding declared; see http://python.org/dev/peps/pep-0263/ for details


IMHO python 2 is doing the right thing not python3 
As I am sure elisp would be doing if we could get a 25 year old version

We could sharpen the error if we liked:

$ cat homoglyphE.py 
# -*- coding: utf-8 -*-
A = 1
А = 2
print("A, А, A==А : %s, %s, %s\n" % (A,А,A==А))



$ python2 homoglyphE.py 
  File "homoglyphE.py", line 3
    А = 2
    ^
SyntaxError: invalid syntax


reply via email to

[Prev in Thread] Current Thread [Next in Thread]