Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax too strict #28

Open
thinsoldier opened this issue Jan 9, 2013 · 7 comments
Open

Syntax too strict #28

thinsoldier opened this issue Jan 9, 2013 · 7 comments

Comments

@thinsoldier
Copy link

The #1 thing people just starting out ask me is if it matters exactly where the ; and { and ( are placed.

In reality it doesn't. But in jsdares If I say

function foo()
{
stuff;
}

instead of

function foo() {
stuff;
}

it fails to run.

That is too strict in my opinion.

Also it doesn't seem to allow for loops inside of functions:

function automate (command) {

for( var i=0; i<command.length; i++) {
robot.drive( command[i] );
}
}

and doesn't seem to accept any kind of array syntax:
automate( [1,6] );

Is there a list of what is and isn't allowed?

And it would be nice if people could register with an existing account:
Google
Facebook
Twitter
BrowserID
OpenID
Other

@janpaul123
Copy link
Owner

Yeah I agree that restricting newlines there is a bit too strict. A lot of restrictions are there so implementing all the cool stuff is easier, but the restrictions you mention serve no purpose.

It seems that there is a bug with arrays, thanks for bringing it to my attention! I'll have a closer look at that.

Registering with an existing account would be brilliant, but I don't have time for implementing that right now... :(

Thanks a lot for your detailed list!

JP

@thinsoldier
Copy link
Author

Forgot to tell you thanks for the great site. I'm making my wife use it.
And a cousin who's been trying to learn JS forever absolutely loves the
robot exercises.

On Thu, Jan 10, 2013 at 5:02 PM, Jan Paul Posma [email protected]:

Yeah I agree that restricting newlines there is a bit too strict. A lot of
restrictions are there so implementing all the cool stuff is easier, but
the restrictions you mention serve no purpose.

It seems that there is a bug with arrays, thanks for bringing it to my
attention! I'll have a closer look at that.

Registering with an existing account would be brilliant, but I don't have
time for implementing that right now... :(

Thanks a lot for your detailed list!

JP


Reply to this email directly or view it on GitHubhttps://github.com//issues/28#issuecomment-12121155.

:: http://thinsoldier.com
:: http://thinsoldier.deviantart.com
:: [email protected]

@jergason
Copy link

Perhaps you could use Esprima to parse the code and compare the parse trees?

@janpaul123
Copy link
Owner

@jergason That would definitely be the way to go. It would take a bit of effort though to make all the interactions work with full Javascript support.

@dawnerd
Copy link

dawnerd commented Apr 22, 2013

I just noticed that you can't use a lot of core js methods. Trying using Math. You get an error saying the variable name cannot be found.

@janpaul123
Copy link
Owner

@dawnerd: Not quite: this can be configured per dare. In the first couple of dares Math has indeed been disabled. But when it is enabled, most of the methods and constants are accessible: https://github.com/janpaul123/jsdares/blob/master/jsmm-applet/output/output.math.js

@benjohnbarnes
Copy link

Can you allow code to be entered in any valid syntax, but reformat it (on line feed, perhaps) to the required syntax for your code augmentation / visualisations?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants