fasttime / JScrewIt

Write any JavaScript with six characters: ! ( ) + [ ]
https://jscrew.it
ISC License
159 stars 12 forks source link

New definitions of "H", "P", "p" and "∞", supposed new Features `ASYNC_FUNCTION`, `ITERATOR` and `JAPANESE_INFINITY` #46

Closed Clayblockunova closed 1 month ago

Clayblockunova commented 2 months ago

idk how hard adding new features by myself is, but I have some new definitions which rely on introducing new features (ITERATOR and JAPANESE_INFINITY).

ITERATOR is for new browsers which have iterator methods, and JAPANESE_INFINITY is for wider usage of Infinity.toLocaleString() in getting "∞" (IE11 on win7 Japanese Infinity string is "+∞").

Clayblockunova commented 2 months ago

just added "p" definition.

fasttime commented 2 months ago

Currently, it's not trivial to add a new feature, I'll see if I can write some instructions. We need the features before we can add the new definitions.

Clayblockunova commented 2 months ago

when will the instructions be finished? how will it be delivered?

fasttime commented 2 months ago

I should be able do it in the next days, I would like to include links to some example commits for reference. Maybe this should be a markdown page in the repo or a wiki page, what do you think?

Clayblockunova commented 2 months ago

I think wiki page is better. And, those existing Markdown pages for API and features can be also turned into wiki pages too.

Clayblockunova commented 2 months ago

sorry. I found that wiki was built days before but only have generic contribution guideline. when will you have specific instruction about creating new features?

fasttime commented 2 months ago

I'm working on this.

fasttime commented 2 months ago

I've added feature ITERATOR_HELPER and created instructions to add a feature here: https://github.com/fasttime/JScrewIt/wiki/Contributing#adding-a-feature. Do you think that's clear enough?

Clayblockunova commented 2 months ago

mostly clear, but IDK how empty function can be used as simulation of Iterator. can new object type be defined by simply defining its constructor function? additionally, for JAPANESE_INFINITY, idk can Infinity.toLocaleString("ja") be simply rewritten. if not, how to simulate?

Clayblockunova commented 2 months ago

btw, I just added a new definition of "P" for Node.js 7.6-15, which relies on a new feature: ASYNC_FUNCTION. this feature is syntax-related and idk how to simulate.

fasttime commented 2 months ago

mostly clear, but IDK how empty function can be used as simulation of Iterator. can new object type be defined by simply defining its constructor function?

That's fine. The emulated objects are just for testing, they are not expected to conform to the specification. For ITERATOR_HELPER, the only interesting property is the fact that iterator helper objects have a string representation like [object Iterator Helper]. Feel free to update the wiki when it's not clear.

additionally, for JAPANESE_INFINITY, idk can Infinity.toLocaleString("ja") be simply rewritten. if not, how to simulate?

You could have a look at how LOCALE_INFINITY is emulated. The main difference would be that the function inside registerNumberToLocaleStringAdapter will accept an argument locale, and if locale is 'ja' and this is Infinity, then the function will return '+∞'.

btw, I just added a new definition of "P" for Node.js 7.6-15, which relies on a new feature: ASYNC_FUNCTION. this feature is syntax-related and idk how to simulate.

It's necessary to overwrite the Function constructor. I did something like that for feature ARROW. I can have a look.

Clayblockunova commented 2 months ago

For simulation of ARROW, you created a function for transforming arrow function to a normal one. should I do anything similar for simulation of ASYNC_FUNCTION?

fasttime commented 2 months ago

For simulation of ARROW, you created a function for transforming arrow function to a normal one. should I do anything similar for simulation of ASYNC_FUNCTION?

Feel free 👍

Clayblockunova commented 1 month ago

sorry, but that's the best I can do.

Clayblockunova commented 1 month ago

Still anything to do? or can be merged now?