Using Unicode in source files and missing Unicode characters

Since I found out that clang was able to compile C ++ source files written in Unicode, I began to use it heavily when writing math code. Compare

uₙ₊₁ᵖ = A*uₙ + B*uₙ₋₁;
uₙ₊₁ᶜ = π * Aₜₒₜ;
uₙ₊₁ = uₙ₊₁ᵖ + uₙ₊₁ᶜ;

and

u_n1_p = A*u_n + B*u_n_1;
u_n1_c = pi * A_tot;
u_n1 = u_n1_p + u_n1_c;

For me it's like day and night: I understand the first part of the code, just reading it, while I just do not want to read the other.

I know that Python3 and Ruby allow Unicode source files, so this feature seems to be spreading.

Objections can be made against this kind of practice: for example, not all fonts support these characters, your source file depends on the encoding you use, and you must actually copy / paste (for example) the Unicode character somewhere in a text editor. However, I think the readability coefficient is really great.

, ( ) . , (. )

:

  • Unicode ? ?

  • ? ( , )

+4
2

"",

  • API
  • , .
  • ( )
  • -/
  • (, )

, ASCII.

, , , , for iₙ.

, , LATIN SUBSCRIPT SMALL LETTER N '(U + 2099) , . , / .

PEP8 , Unicode - , , .

- , , . , , .

+2

OP: ever since?

. Unicode , ASCII - ? # Javascript , Unicode-. # System.Math:

    //     Represents the natural logarithmic base, specified by the constant, e.
    public const double E = 2.7182818284590451;

    //     Represents the ..., specified by the constant, π.
    public const double PI = 3.1415926535897931;

unicode π, ℯ. , , :

 double circumference = 2 * Math.π * r;

e , , . , unicode ℯ (U + 212F), ℮ (U + 212E), , . .

, , , , Unicode.

System.Math ascii E PI unicode π.

№ 1, , , . φ phi, δ delta d, :

var x = 2 * π * sin(φ);

, ascii.

ascii unicode, - us-english. , , , . , , . (: ) , , # Javascript : for, if, else,...

: : : , . (): , , .

/: . , , : n+1 , #/++. .

0

Source: https://habr.com/ru/post/1539204/


All Articles