Re: Forwards-compatible syntax proposal
On Fri, May 9, 2008 at 4:18 AM, Ian Hickson [EMAIL PROTECTED] wrote: One of the problems with ES4 relative to ES3 is that the new syntax means that a script using ES4 features doesn't work in ES3 compilers. There's not much we can do in the ES3-ES4 language migration about this. But we _can_ prevent this problem from existing again in ES5 and up. [...] I may have missed some things we should include, and the grammar above may be too simple and may have to have changes made, but hopefully it conveys the basic idea. Comments? what about http://wiki.ecmascript.org/doku.php?id=proposals:versioning and http://wiki.ecmascript.org/doku.php?id=discussion:versioning ? if I read those documents well ES1-4 support backward-compatibility and later for ES5 etc. we could either use application/ecmascript;version=5 or the global __MAX_ECMASCRIPT_VERSION__ or the pragma use edition 5 re-reading what you're asking But we _can_ prevent this problem from existing again in ES5 and up. do you mean you wish an ES5 script to be able to run in an ES4 interpreter/compiler ? I don' think that 1) it's possible and 2) it's wishable if you got application/ecmascript;version=4 and want to run a ES5 script, you fall in the same situation as ES3.1 vs ES4 see http://wiki.ecmascript.org/doku.php?id=proposals:versioning Modifications of Global Bindings Changing global object bindings is incompatible with ES4. If ES3 or ES3.1 code tries to overwrite these bindings before any ES4 code has executed in the current document, these bindings are changed, but further ES4 scripts will not execute in that document. If ES3 or ES3.1 code tries to overwrite these bindings after any ES4 code has executed in the current document, the bindings will be treated as readonly and the attempt to change them will fail silently. so ES3.1 and ES4 are a special situation, but in the context of having an ES5 script running inside an ES4 interpreter and having errors failing silently that could be really a hell to debug. cheers, zwetan ___ Es4-discuss mailing list Es4-discuss@mozilla.org https://mail.mozilla.org/listinfo/es4-discuss
Re: Forwards-compatible syntax proposal
This wouldn't work. Without syntactically distinguishing a / that is a division from a / that starts a regexp, there is no way to find the end of the block. To make this distinction you need to be able to parse the contents of the block without errors. To complicate matters further, various language extension proposals, ranging from ES3.1 to various ES4 extensions, muck with the regexp syntax. Waldemar Ian Hickson wrote: One of the problems with ES4 relative to ES3 is that the new syntax means that a script using ES4 features doesn't work in ES3 compilers. There's not much we can do in the ES3-ES4 language migration about this. But we _can_ prevent this problem from existing again in ES5 and up. I propose that ES4 clients, when they hit a syntax error, back up to the start of the current block, and then look for the end of the block, which is the } corresponding to the last token in this grammar: block = { tokens* } tokens = block | string | comment | regexp | other string = single-quote [ no-backslash | escape ]* [ single-quote | end of line ] string = double-quote [ no-backslash | escape ]* [ double-quote | end of line ] string = (triple-quoted string) no-backslash = anything but \ escape = \ followed by anything comment = /* ... */ comment = // ... end of line comment = !-- ... end of line regexp = / [ no-backslash | escape ]* [ / | end of line ] other = anything else ...and then compile the whole block to one throw SyntaxError statement. I may have missed some things we should include, and the grammar above may be too simple and may have to have changes made, but hopefully it conveys the basic idea. Comments? ___ Es4-discuss mailing list Es4-discuss@mozilla.org https://mail.mozilla.org/listinfo/es4-discuss
Re: Forwards-compatible syntax proposal
2008/5/13 [EMAIL PROTECTED]: what about http://wiki.ecmascript.org/doku.php?id=proposals:versioning and http://wiki.ecmascript.org/doku.php?id=discussion:versioning ? if I read those documents well ES1-4 support backward-compatibility and later for ES5 etc. we could either use application/ecmascript;version=5 or the global __MAX_ECMASCRIPT_VERSION__ or the pragma use edition 5 On developer tools and mime-types, subversion will treat application/ecmascript as binary. http://subversion.tigris.org/faq.html#binary-files Subversion treats the following files as text: - Files with no svn:mime-type - Files with a svn:mime-type starting text/ - Files with a svn:mime-type equal to image/x-xbitmap - Files with a svn:mime-type equal to image/x-xpixmap All other files are treated as binary, meaning that Subversion will: - Not attempt to automatically merge received changes with local changes during svn update or svn merge - Not show the differences as part of svn diff - Not show line-by-line attribution for svn blame ___ Es4-discuss mailing list Es4-discuss@mozilla.org https://mail.mozilla.org/listinfo/es4-discuss