Skip to content

Instantly share code, notes, and snippets.

@Jack-Works
Last active March 1, 2024 02:23
Show Gist options
  • Save Jack-Works/829246dcae9d9d3b874d44bae5ef5e0b to your computer and use it in GitHub Desktop.
Save Jack-Works/829246dcae9d9d3b874d44bae5ef5e0b to your computer and use it in GitHub Desktop.
cRAzY eSnEXt (*all* proposals mixed in)
#! Aaaaaaaaaaa this is JS!!!
// https://github.com/tc39/proposal-hashbang
// This file is mixing all new syntaxes in the proposal in one file without considering syntax conflict or correct runtime semantics
// Enjoy!!!
// Created at Nov 23, 2018
for await(const x of (new A // https://github.com/tc39/proposal-pipeline-operator
|> do { // https://github.com/tc39/proposal-do-expressions
case(?) { // https://github.com/tc39/proposal-pattern-matching
when {val}: class {
#[?]: ?; // https://github.com/tc39/proposal-private-fields
fn(...n) {
// https://github.com/tc39/proposal-nullish-coalescing
// https://github.com/tc39/proposal-slice-notation
return this.#[?] ??= n[2:3]
}
}
when _: ?
}
}
|> ::?.fn // https://github.com/tc39/proposal-bind-operator
|> ?.map do(x) { x -> x + 1}
// https://github.com/tc39/proposal-record-tuple
// https://github.com/tc39/proposal-numeric-separator
// https://github.com/tc39/proposal-extended-numeric-literals
|> (? ?? ? ?? {# a: 1_2_3 #} ?? {| b:2_px |})
|> (async _ =>* { return ? })()) { // https://github.com/tc39/proposal-generator-arrow-functions
}
#! Aaaaaaaaaaa this is JS!!!
// https://github.com/tc39/proposal-hashbang
// This file is mixing all new syntaxes in the proposal in one file without considering syntax conflict or correct runtime semantics
// Enjoy!!!
// Created at Jun 17, 2019
mixin W {} // mixin proposal, I can't find a link for it
let val = do { // https://github.com/tc39/proposal-do-expressions
// https://github.com/tc39/proposal-generator-arrow-functions
// https://github.com/tc39/proposal-logical-assignment
// https://github.com/tc39/proposal-throw-expressions
((f ||= throw new TypeError('Aaaaaahhhhh')) =>* {
"hide implementation" // https://github.com/tc39/proposal-function-implementation-hiding
protocol Ahhhhhhh { // https://github.com/tc39/proposal-first-class-protocols
tag;
toString() {
return `[object ${this[Ahhhhhhh.tag]}]`[2:6]; // https://github.com/tc39/proposal-slice-notation
}
}
Protocol.implement(Promise, function.sent); // https://github.com/tc39/proposal-function.sent
case ( // https://github.com/tc39/proposal-pattern-matching
yield
|> await // https://github.com/tc39/proposal-pipeline-operator
|> (yield #)
|> fn(a ??= ? ?? ? ?? ? ?? ? ?? ? ?? ? ?? ? ?? ? ?? ?, 2333)
|> a(1) { } // I don't recall what this proposal is
) { // https://github.com/tc39/proposal-private-fields
// https://github.com/tc39/proposal-class-static-block
when a -> a |> ? ?? ? ?? class { #[?]: ?, static { do {? ?? ?}} }
}
})?.() ?.next( // https://github.com/tc39/proposal-nullish-coalescing
class Comment extends Model |> Editable |> Sharable |> Promisable with M {
static {
using(class.f()) {}
}
constructor() { // https://github.com/littledan/proposal-new-initialize
new.initialize()
}
} // https://github.com/tc39/proposal-extended-numeric-literals
).next(233@px)
}
// https://github.com/tc39/proposal-decorators
decorator @px {
@numericTemplate(({ number }) => CSS.px(number))
}
#! Aaaaaaaaaaa this is JS!!!
// https://github.com/tc39/proposal-hashbang
// This file is mixing all new syntaxes in the proposal in one file without considering syntax conflict or correct runtime semantics
// Enjoy!!!
// Created at Nov 21, 2020
import data from "./data.json" assert { type: "json" } with { as: "record" }; // https://github.com/tc39/proposal-import-assertions#follow-up-proposal-evaluator-attributes
import { onTransform, unwrap, log, onMounted, sensitive, dispatch, smartElement, CSS } from './utils.js';
import ::{ "😂" as send } from "async-call-rpc"; // https://github.com/tc39/ecma262/pull/2154 and https://github.com/hax/proposal-extensions
asset report from "report"; // https://github.com/tc39/proposal-asset-references
with operators from Decimal; // https://github.com/tc39/proposal-operator-overloading
with suffix px = CSS.px // https://github.com/tc39/proposal-extended-numeric-literals
protocol RPC { // https://github.com/tc39/proposal-first-class-protocols
address; send(method, ...args) { return this.address::send()~.[method](...args) } } // https://github.com/tc39/proposal-wavy-dot
@{ author: "Jack Works" } class MyHandler extends HTMLElement with smartElement { // https://github.com/justinfagnani/proposal-mixins and https://github.com/tc39/proposal-decorators/blob/master/EXTENSIONS.md#annotation-syntax
async constructor() { super(); await.race [import(report), import(module { export default await import('./fallback.js') })] } // async init proposal and https://github.com/tc39/proposal-await.ops and https://github.com/tc39/proposal-js-module-blocks
outer static #brand = 'my handler' // https://github.com/tc39/proposal-private-declarations
static { debugger.log(['Defined as ', this, this.#brand]) } // https://github.com/tc39/proposal-class-static-block and https://github.com/tc39/proposal-standardized-debug
#data = data[0:100]; // https://github.com/tc39/proposal-slice-notation
onNewChild(child) { !(try child.#data) && throw new TypeError('Illegal') } // https://github.com/tc39/proposal-private-fields-in-in and https://github.com/tc39/proposal-throw-expressions
[Symbol.asyncIterator]: async () =>* { "hide source" // https://github.com/tc39/proposal-function-implementation-hiding and https://github.com/tc39/proposal-generator-arrow-functions
while (function.sent) // https://github.com/tc39/proposal-function.sent
for (const datum of this.#data) {
try using(const f = function.sent) { // https://github.com/tc39/proposal-explicit-resource-management
yield do { // https://github.com/tc39/proposal-do-expressions
if (const val = datum |> sensitive |> f(this, ?) |> await.all |> sensitive) { // https://github.com/tc39/proposal-pipeline-operator and https://github.com/tc39/proposal-partial-application and https://github.com/tc39/proposal-Declarations-in-Conditionals
val = case (val) { // https://github.com/tc39/proposal-pattern-matching
when #{ type: 'throw', error: e } -> throw new Error(e), // https://github.com/tc39/proposal-record-tuple
when #{ type: 'batch', list: arr } -> await.all arr.map(x => import(x)),
when #{ type: 'normal', ...rest } -> #{ ...val, meta.received: Date.now() } // https://github.com/tc39/proposal-deep-path-properties-for-record
}
runTimes++; val |> dispatch(this, 'transform', {| details: val |}); } } } } } // https://github.com/keithamus/proposal-object-freeze-seal-syntax
@init: onTransform transformHandler = () => this.style.fontSize ||= runTimes > 10 ? 24px : 12px // https://github.com/tc39/proposal-decorators#option-b-init-method-decorators
@onMounted { // https://github.com/tc39/proposal-decorators/blob/master/EXTENSIONS.md#block-decorators
this.addEventListener('transform') do (@unwrap event) { // https://github.com/samuelgoto/proposal-block-params and https://github.com/tc39/proposal-decorators/blob/master/EXTENSIONS.md#parameter-decorators-and-annotations
console.log(event, class.#brand) } } // https://github.com/tc39/proposal-class-access-expressions
static [RPC.address] = 'http://localhost:8080/';
}; Protocol.implement(MyHandler, RPC);
let @(log(x => `@@iterator on ${MyHandler.#brand} ran for ${x} times`)) runTimes = 0m; // https://github.com/tc39/proposal-decorators/blob/master/EXTENSIONS.md#let-decorators and https://github.com/tc39/proposal-decimal
try { import dev from "enhance-devtools"; window.devtoolsFormatters = #[...window?.devtoolsFormatters, dev]; } catch {} // https://github.com/benjamn/reify/blob/master/PROPOSAL.md
@necauqua
Copy link

While I completely agree with the point of 'to much syntax, wtf is this', I really really really hate it when people do deceptive maneuvers to 'prove' their point, even if I agree with it.

So here is the above file but formatted properly so it does not actually look like a mess on the first glance, like the author tried to imply:

#! Aaaaaaaaaaa this is JS!!!
// https://github.com/tc39/proposal-hashbang
// This file is mixing all new syntaxes in the proposal in one file without considering syntax conflict or correct runtime semantics
// Enjoy!!! 
// Created at Nov 21, 2020

import data from "./data.json" assert { type: "json" } with { as: "record" }; // https://github.com/tc39/proposal-import-assertions#follow-up-proposal-evaluator-attributes
import { onTransform, unwrap, log, onMounted, sensitive, dispatch, smartElement, CSS } from './utils.js';
import ::{ "😂" as send } from "async-call-rpc"; // https://github.com/tc39/ecma262/pull/2154 and https://github.com/hax/proposal-extensions

asset report from "report"; // https://github.com/tc39/proposal-asset-references

with operators from Decimal; // https://github.com/tc39/proposal-operator-overloading
with suffix px = CSS.px // https://github.com/tc39/proposal-extended-numeric-literals

protocol RPC { // https://github.com/tc39/proposal-first-class-protocols
    address;

    send(method, ...args) {
        return this.address::send() ~. [method](...args)
    }
} // https://github.com/tc39/proposal-wavy-dot

@{ author: "Jack Works" } class MyHandler extends HTMLElement with smartElement { // https://github.com/justinfagnani/proposal-mixins and https://github.com/tc39/proposal-decorators/blob/master/EXTENSIONS.md#annotation-syntax 

    async constructor() {
        super();
        await.race [
            import(report),
            import(module { export default await import('./fallback.js') })
        ]
    } // async init proposal and https://github.com/tc39/proposal-await.ops and https://github.com/tc39/proposal-js-module-blocks

    outer static #brand = 'my handler' // https://github.com/tc39/proposal-private-declarations

    static {
        debugger.log(['Defined as ', this, this.#brand])
    } // https://github.com/tc39/proposal-class-static-block and https://github.com/tc39/proposal-standardized-debug

    #data = data[0:100]; // https://github.com/tc39/proposal-slice-notation

    onNewChild(child) {
        !(try child.#data) && throw new TypeError('Illegal')
    } // https://github.com/tc39/proposal-private-fields-in-in and https://github.com/tc39/proposal-throw-expressions
 
    [Symbol.asyncIterator]: async () =>* {
        "hide source" // https://github.com/tc39/proposal-function-implementation-hiding and https://github.com/tc39/proposal-generator-arrow-functions
        
        while (function.sent) // https://github.com/tc39/proposal-function.sent
            for (const datum of this.#data) {
                try using(const f = function.sent) { // https://github.com/tc39/proposal-explicit-resource-management
                    yield do { // https://github.com/tc39/proposal-do-expressions
                        if (const val = datum |> sensitive |> f(this, ?) |> await.all |> sensitive) { // https://github.com/tc39/proposal-pipeline-operator and https://github.com/tc39/proposal-partial-application and https://github.com/tc39/proposal-Declarations-in-Conditionals
                            val = case (val) { // https://github.com/tc39/proposal-pattern-matching
                                when #{ type: 'throw', error: e } -> throw new Error(e), // https://github.com/tc39/proposal-record-tuple
                                when #{ type: 'batch', list: arr } -> await.all arr.map(x => import(x)),
                                when #{ type: 'normal', ...rest } -> #{ ...val, meta.received: Date.now() } // https://github.com/tc39/proposal-deep-path-properties-for-record
                            }
                            runTimes++;
                            val |> dispatch(this, 'transform', {| details: val |});
                        }
                    }
                }
            }
        } // https://github.com/keithamus/proposal-object-freeze-seal-syntax

    @init: onTransform transformHandler = () =>
        this.style.fontSize ||= runTimes > 10 ? 24px : 12px // https://github.com/tc39/proposal-decorators#option-b-init-method-decorators

    @onMounted {  // https://github.com/tc39/proposal-decorators/blob/master/EXTENSIONS.md#block-decorators
        this.addEventListener('transform') do (@unwrap event) { // https://github.com/samuelgoto/proposal-block-params and https://github.com/tc39/proposal-decorators/blob/master/EXTENSIONS.md#parameter-decorators-and-annotations
            console.log(event, class.#brand)
        }
    } // https://github.com/tc39/proposal-class-access-expressions

    static [RPC.address] = 'http://localhost:8080/';
};

Protocol.implement(MyHandler, RPC);

let @(log(x => `@@iterator on ${MyHandler.#brand} ran for ${x} times`)) runTimes = 0m; // https://github.com/tc39/proposal-decorators/blob/master/EXTENSIONS.md#let-decorators and https://github.com/tc39/proposal-decimal

try {
    import dev from "enhance-devtools";

    window.devtoolsFormatters = #[...window?.devtoolsFormatters, dev];
} catch {} // https://github.com/benjamn/reify/blob/master/PROPOSAL.md

@Jack-Works
Copy link
Author

Ah, I make it dense to cut the screenshot easier. This is originally a joke among my programmer friends (see the 2018 and 2019 version), I tried to make it confuse as possible (as you can see a ??= ? ?? ? ?? ? ?? ? ?? ? ?? ? ?? ? ?? ? ?? ? in 2019 version, but ?? are widely used by JS programmers in this year so I removed it in 2020 version). 😂😂 Hope I didn't give JS one more bad name.

@necauqua
Copy link

Yeah I am sorry if I was being way too aggressive, it just really bothered me for some reason and obviously I didn't think of any less malicious reasons, such as making it into a screenshot, heh

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