Skip to content

Instantly share code, notes, and snippets.

Created May 4, 2017 10:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/2e8babd349167a49eb6f6d55ec0505c9 to your computer and use it in GitHub Desktop.
Save anonymous/2e8babd349167a49eb6f6d55ec0505c9 to your computer and use it in GitHub Desktop.
#!/usr/bin/env escript
%% -*- coding: utf-8 -*-
%%! +pc unicode
-module(hello).
%-mode(compile).
-export([main/1, 'hello_юникод_世界,'/0]).
main(_) ->
% io:format("~p~n", [{io:printable_range(), io:getopts()}]),
% 'hello_'(),
io:setopts([{encoding,unicode}]),
% io:format("~p~n", [{io:printable_range(), io:getopts()}]),
'hello_юникод_世界,'(),
io:format("~tp~n", [{"Hello, 世界, юникод"}]).
'hello_юникод_世界,'() ->
io:format("~tp~n", [{'hello_юникод', <<"Hello, 世界; юникод"/utf8>>, "Hello, 世界; юникод"}]).
@c0b
Copy link

c0b commented May 4, 2017

to compile it with erlc or c() in Erlang shell, the first line has to be commented out, but how about change erl compiler to ignore first line if it starts with #! ?

@kvakvs
Copy link

kvakvs commented May 4, 2017

It's not even the 20 release, and unicode names are quickly getting unreadable and out of control 😄

@c0b
Copy link

c0b commented May 31, 2017

@kvakvs the Java world, and JavaScript supported Unicode identifier since the very beginning (since 90s?) and supported by many other programming languages as I know; did any of those get out of control 😄 ?

 ./opt/node-v8.0.0-linux-x64/bin/node
> var hello_юникод_世界 = 42;
undefined
> hello_юникод_世界
42
> console.log(hello_юникод_世界);
42
undefined

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment