News for hackers. Stuff that matters.
Re:Porffor: A from-scratch ahead-of-time JS engine by the_imp on Tuesday July 30, 2024 @06:14PM (#41114642)
With Extractors [1] (currently at Stage 1), you could define something like this to work:

    const Integer = {
      [Symbol.customMatcher]: (value) => [Number.parseInt(value)]
    }

    const Integer(counter) = 42.56;
    // counter === 42
[1] https://github.com/tc39/proposal-extractors

There are no comments on this comment yet.