☃ as a Namespace



☃ as a Namespace

0 0


snowman.js


On Github dharden / snowman.js

☃ as a Namespace

@dharden

☃.js

Can you use ☃ as a JavaScript namespace?

NO

Thanks!

By @dharden

okay but really tho

Unicode

Thank you, @mathias and @eevee

Code Points

  • U+0000 to U+10FFFF
  • 0000 to FFFF = Basic Multilingual Plane (BMP)
  • 010000 to 10FFFF = Supplementary or Astral Plane
  • ☃ = U+2603
  • D = U+0044
  • 💩 = U+1F4A9
http://unicode.org/mail-arch/unicode-ml/y2005-m11/0060.html
What is little-known generally is that the "U+" convention itself was an ASCII-fied compromise for what the Unicode designers *really* wanted to use for the Unicode hexadecimal prefix, which was U+228E MULTISET UNION (whose glyph is a union sign with a plus sign in it).
The semantic appropriateness of MULTISET UNION as a designator for Unicode code points ought to be apparent, and the shape of the union symbol itself was iconic for the "U" of Unicode. But use of the symbol in data files and documentation in the early days was problematical, of course, and it soon gave way to the much more practical use of "U+" instead.

okay so javascript

DAN - U+0044 U+0041 U+004E

            >> console.log('\x44\x41\x4e');
DAN
          

ಠ_ಠ - U+0CA0 KANNADA LETTER TTHA

            >> console.log('\u0cA0');
ಠ
          

🍕 U+1F355 SLICE OF PIZZA

            >> console.log('\u{1f355}');
🍕
          

Sidenote: wtf is emoji?

            >> var pizza = '🍕';
>> console.log(pizza.length);
2
          
            >> console.log(pizza.charCodeAt(0).toString(16));
d83c
>> console.log(pizza.charCodeAt(1).toString(16));
df55
          

Surrogate Pairs

U+D800 - U+DFFF

JavaScript's strings are unsigned 16-bit integers, so astral plane control points are represented with pairs

U+1F355 SLICE OF PIZZA

http://www.fileformat.info/info/unicode/char/1F355/index.htm
            >> console.log('\ud83c\udf55');
🍕
          

VARIABLES

ECMAScript 5.1

ECMAScript 2015

https://mathiasbynens.be/notes/javascript-identifiers-es6 In ES6, identifiers must start with $, _, or any symbol with the Unicode derived core property ID_Start. The rest of the identifier can contain $, _, U+200C zero width non-joiner, U+200D zero width joiner, or any symbol with the Unicode derived core property ID_Continue.
thank you, https://mathiasbynens.be/notes/javascript-identifiers, http://stackoverflow.com/questions/1661197/what-characters-are-valid-for-javascript-variable-names
            var 〱〱〱〱 = "less than? wtf";
var जावास्क्रिप्ट = "javascript";
var ಠ_ಠ = "disapproval";
          
            var π = Math.PI;

function calculateCircumference(radius) {
  return 2 * π * radius;
}

calculateCircumference(1); //6.283185307179586
          

http://unicode.org/cldr/utility/character.jsp?a=2603
https://mothereff.in/js-variables

Can you use ☃ as a JavaScript namespace?

NO

Thanks!

By @dharden

☃ as a Namespace @dharden