[Python-ideas] Allow additional separator character in variables
python at mrabarnett.plus.com
Sun Nov 19 22:12:50 EST 2017
On 2017-11-20 00:20, Chris Angelico wrote:
> On Mon, Nov 20, 2017 at 11:01 AM, Mikhail V <mikhailwas at gmail.com> wrote:
>> 1. The future versions of syntax, ideally, must allow ONLY minus U2212 for
>> the minus operator, and allow hyphens 002D in identifiers. Since it is
>> to the current moment, I must think out the least painful transition.
> The least painful transition is to devise an entirely new language,
> one that is built around whatever rules you like. That way, there's no
> backward compatibility problem - you pick a new file extension, a new
> executable name, etc, etc, and nobody gets confused. Of course, since
> actually building a cross-platform language interpreter is a ton of
> work, and getting an ecosystem of libraries is even more work, you'll
> want to make your language compile to Python, but *in your source
> code* you can use whatever symbols you want.
> Since you want U+2212 for subtraction, you probably want to use a few
> other non-ASCII operators too. U+2044 FRACTION SLASH presents itself
> as a viable way to create a fractions.Fraction literal. Instead of *
> and @ for multiplication, you could have U+00D7 and... uhh, I'm not a
> mathematician, but I'm sure there's an appropriate character.
If we must use U+2212 (MINUS SIGN) for the minus sign, then it's only
right that we must also use U+2010 (HYPHEN) for the hyphen.
U+002D (HYPHEN-MINUS) can be left alone, its meaning depending on the
programming language, as at present.
> For the most part, you'd have code that is trivially transformable to
> and from Python. Start by writing the "my language to Python"
> translator (it can throw away comments and stuff, the Python code
> should be considered "object code" rather than "source code"), and
> then look into the reverse transformation for the benefit of people
> trying to learn your language.
> As long as you don't actually call your language "Python", you're free
> to do what you like without worrying about compatibility etc.
More information about the Python-ideas