Khan / live-editor

A browser-based live coding environment.
Other
762 stars 184 forks source link

Basic features and some ES6 doesn't work. #651

Open RobbieGM opened 6 years ago

RobbieGM commented 6 years ago

I would really like if we could use all of this in our Khan Academy code:

function f() { // Very basic. Yet Oh Noes prefers us writing it the messier way.
}
async function getButtonPressed() { // No, I didn't mean to type "asin", Oh Noes.
     return (await buttonClickedPromise).name;
}
class HowAboutThis { // It would also be nice if we could do elegant classes like this.
    constructor(x) {
        this.x = x;
    }
}
let thisDoesntWork = true;
const neitherDoesThis = true;

square = x => x * x; // Arrow functions would also be good

let enhancedObjectLiteral = {
    value: 3,
    square, // Easy shorthand for square: square,
    getDoubleValue() { return value * 2; } // Easy methods read like functions
};

function defaultParametersAreVeryUseful(a, isCorrect=true, b, c) {}
function restParametersAreBetterThanArgumentsList(a, b, ...rest) {}

for (let x of iterable) {
    // much better than "for (var i = 0; i < iterable.length; i++) { iterable[i] }
}

function * getPositiveIntegers(x=0) {
    yield x + 1;
}

// Thanks for your consideration. Teaching new programmers ES6 features will not only help their code be better, it will make sure they are up to date with modern JavaScript when they eventually get a job.
JettBurns14 commented 6 years ago

Currently we only support ES5. It would be nice to support ES6 at some point.

From #629.

This old Live Editor project has been receiving zero resources from the team for a good while, and probably won't be updated until they focus on the Computing section again. Just typical organization priorities and focus!

FYI, the webpage environment offers a little more freedom. You can use function declarations, let, const, and a few other things I may have left out.

I do agree with your request though, gave you a thumbs up. 😃

Ben-Rivers commented 6 years ago

If you really want to use some of the more basic features in the live editor (like me), you can put jshint ignore:start at the beginning of your program.

tabishimran commented 6 years ago

@JettBurns14 , I'm looking for ways to contribute to the computing section. I can't seem to find any of current repositories. Was this repo moved to some other page?

JettBurns14 commented 6 years ago

Hello @txjoe, unfortunately this repository is no longer receiving attention from the KA engineers (see README); and nope, it hasn't been moved.

Since you still might want to contribute to the Live Editor anyway, I recommend you look through the open issues if you haven't already and see if you can fix some things locally, and create pull request(s) with your working changes. I'm pretty sure all setup instructions are in the README.

Hope this helps, I plan to begin submitting my own fixes in the Summer, perhaps we can work together later on!

tabishimran commented 6 years ago

The readme section advices against submitting PRs though.

JettBurns14 commented 6 years ago

This is true, but in my opinion, if you submit good code that works and thus doesn't take long to review, there's a chance it could be merged. No hurt in trying!

naclcaleb commented 5 years ago

I'm working on figuring out how to get JSHint to allow it.

The BabyHint parser was easy to hack; just changed some regexes and good to go. The global variables seem to be defined using JSHint.

Please correct me if I'm wrong, because the jshint.js file is not pretty to look at!