2022-08-06, a Saturday

JavaScript.

school

In somewhat reverse chronological order, (and not necessarily about JavaScript)

  1. type Pointer<T> = T
    

    is syntactically valid TypeScript.

  2. Investigate: How does Symbol.unscopables affect document being in lexical scope inside element attribute event handlers?

  3. Someone requested Node remove HTTP 418.

  4. TechRadar reviews Atom as a note-taking app.

  5. JavaScript’s module resolution is complicated.

  6. Service workers can change headers because they act as client-side middleware.

  7. A PHP bug:

    strtotime() returning 1999-11-30 for 00-00-00 00:00:00

    Status: Not a bug

    There is no bug here, 00-00-00 means 2000-00-00, which is 1999-12-00, which is 1999-11-30. No bug, perfectly normal.

  8. SharedArrayBuffers are again no longer supported on GitHub Pages.

  9. Investigate: does JS garbage collect modules?

    setInterval(() => import('./something.js?_=' + Date.now()))
    
  10. Someone implemented TypeScript using TypeScript types.

  11. <object>

  12. The CSS spec says “Godspeed!”

    It is at the time or writing undefined how percentage heights inside tables work in CSS. This specification does not try to specify what to use as the containing block for calculating percentage heights in tables. Godspeed!

  13. The UK has decided that <input type="number"> is a bad idea.

  14. #! starts a comment, but only at the start of a script. So now there’s four ways of commenting in JavaScript.

  15. ES4 was going to have namespaces, among other cursed things. Strict mode would’ve required semicolons, yet syntax errors would be thrown at runtime when reached.

  16. Is ++i++ not an error in any programming language?

  17. Julia missing is akin to NaN.

  18. TypeScript infer

  19. Float-to-i32 overflow is defined in JavaScript. (2**34 + 1) | 0 produces 1 because x86’s cvtsd2si is wrapping. ARM’s double-to-i32 instruction is saturating, so it’d instead become the max integer, 0x7fff_ffff. So, ARM has an instruction specifically for emulating x86: Floating-point Javascript Convert to Signed fixed-point, rounding toward Zero.

  20. Object.hasOwn

  21. Adding a ZWSP to a variable name makes a new, unique variable name despite appearing identical.

  22. Bad web design: willreed.com

  23. Recreating Python with statements:

    const { open } = require('fs')
    
    with (open('file.txt').as('file')) {
      console.log(file.read())
    }
    

    using a FinalizationRegistry to close the context manager when it gets garbage collected.

  24. new Poop() and new Poop are different operators, and new with arguments takes precedence over new without arguments, so new new Object() is valid syntax.

    new new Function("console.log('hi')")().constructor()
    
  25. You can use computed property names for class fields:

    undefined instanceof
      class {
        static [Symbol.hasInstance] = () => this
      }
    
  26. Escape sequences in variable names

  27. Symbol.hasInstance lets you override the behaviour of B in a instanceof B, so a class can say everything is an instance of it, for multiple inheritance (a horrible idea).

  28. When using with, the lexical environment excludes properties enumerated in Symbol.unscopables.

  29. Object.keys({ 4294967296: 0, 4294967295: 0, 4294967294: 0 })
    
  30. MDN spotlights a furry.

    Contributor spotlight

    Gooborg family?

other things:

See source and revision history on GitHub.