I am seriously dubious as to whether JSGI should require JavaScript 1.7. This is not an ECMA standard, and AFAIK is not implemented outside of Mozilla.
While I'm a huge Mozilla fan, I don't think making CommonJS specific to Mozilla implementations of JavaScript is wise.
It would be nice to be able to implement the standards in any ES3-compliant JavaScript engine, and there are LOT out there. ES5 should be adopted quickly as well -- after ratification -- although I would suggest thinking long and hard about making use of ES5 features in core libraries.
What about a shim to implement as much of ES5 as can be monkey-patched on to ES3? Especially the array extras and the JSON stuff. Is this an unreasonable requirement?
On Thu, Aug 27, 2009 at 7:17 AM, Dean Landolt <de...@deanlandolt.com> wrote:
On Thu, Aug 27, 2009 at 9:02 AM, Wes Garland <w...@page.ca> wrote:
I am seriously dubious as to whether JSGI should require JavaScript 1.7. This is not an ECMA standard, and AFAIK is not implemented outside of Mozilla.
While I'm a huge Mozilla fan, I don't think making CommonJS specific to Mozilla implementations of JavaScript is wise.
I agree. I only brought up destructuring to prompt this very conversation.
It would be nice to be able to implement the standards in any ES3-compliant JavaScript engine, and there are LOT out there. ES5 should be adopted quickly as well -- after ratification -- although I would suggest thinking long and hard about making use of ES5 features in core libraries.
ES3 compliance seems like a good, objective baseline.
This is what Narwhal does. We're targetting "ES5" compliance, to the
extent that it is possible to monkey-patch future-ready functions onto
ES3 with the addendum that compliant code may not use for(var iterand
in array) notation.
For the migration between ES3 and ES5, this requires a more nuanced
approach than one or the other. I would rather not waste time
enumerating what portion of ES5 we support, but that is what the
situation calls for in the interim. Perhaps we can save some time and
absorb some headache for the time being in hope of a brighter future
by suggesting that "compliant" implementations must be ES5, and in so
far as that our current implementations fall short of ES5, we are not
compliant.
Narwhal's Object.freeze transparently returns the same object without
modification. That allows us to write code that will work when
Object.freeze works, as long as we make no promises that our code is
secure on our current implementations. We have a stub for
Object.defineProperty that uses engine specific means of defining
properties, but has to ignore most of the traits.
Kris Kowal
I believe we already require JSON. And jsgi requires array.forEach.
I don't think it's been made official, but my understanding was any of
the ES5 methods we could implement easily via JS would be required
(namely the Array methods and JSON, as you mentioned).
On Thu, Aug 27, 2009 at 8:28 AM, Mark Porter <dm4...@gmail.com> wrote:What about a shim to implement as much of ES5 as can be monkey-patched on to ES3? Especially the array extras and the JSON stuff. Is this an unreasonable requirement?
I would go further and advocate that CommonJS use ES5 as a base, not ES3. In that context a shim would be tremendously valuable as it would allow us to proceed well while waiting for ES5 engines to become available.
You don't. But ES5 has very few syntax changes. Just ignore those
until we can ignore ES3. Likewise with other more interesting features
of ES5 that cannot be practically emulated in ES3. For the moment, as
a practical matter, rely only on the parts of ES5 that can be
implemented in ES3. But as soon as enough ES5 implementations are
available, drop that constraint. This is a transitional issue only.
--
Cheers,
--MarkM
+1
--
Cheers,
--MarkM
>
> I love it. But again, what about syntax changes? To say "ES5
> compliance" is to say all current implementations should implement
> new ES5 syntax, e.g. generators and destructuring. Would it be more
> productive to say CommonJS 1.0 (or whatever) compliance is ES5 sans
> new syntax. That doesn't preclude devs from using the shiny newness
> when they know they can (or provide fallbacks).
Next time go read the spec before quoting things about it. Last time i
checked ES5 didn't have destructuring assignment or generators - those
remain Mozilla only extensions.
http://wiki.ecmascript.org/doku.php?id=harmony:destructuring
http://wiki.ecmascript.org/doku.php?id=proposals:iterators_and_generators
Are not in ES5.
--
Text by me above is hereby placed in the public domain
Cheers,
--MarkM
On Thu, Aug 27, 2009 at 12:48 PM, Kris Kowal <cowber...@gmail.com> wrote:
For the migration between ES3 and ES5, this requires a more nuanced
approach than one or the other. I would rather not waste time
enumerating what portion of ES5 we support, but that is what the
situation calls for in the interim. Perhaps we can save some time and
absorb some headache for the time being in hope of a brighter future
by suggesting that "compliant" implementations must be ES5, and in so
far as that our current implementations fall short of ES5, we are not
compliant.
> With the exception of Kris' statement of "we are not compliant" above, I
> don't think I've seen anyone disagree with the 3 points that I make here. I
> think we should just move forward with that.
Ironically, the issue hangs on our recent name change. So long as we
were named serverjs, if we imagined that we were writing a standard
purely for server-side use where upgrade to new JS versions can be
quick, I think Kris' original language was the right thing. Now that
our name change has clarified our purpose to include browsers, where
we have to assume the normal 5 year lag, I agree with Kevin's
phrasing.
It's a shame. I was looking forward to libraries that were free to use
all of ES5. Perhaps we should make explicit that the subset of our
libraries intended only for server side use, such as File, can assume
all of ES5?
--
Cheers,
--MarkM
Let me propose something specific and anyone who dissents please speak up:
1. CommonJS specifically targets the subset of ES5 that can be implemented in ES3
2. This subset should be enumerated
3. Individual implementations of CommonJS are free to require other ES or JS features, but the standard will only require #1.
With the exception of Kris' statement of "we are not compliant" above, I don't think I've seen anyone disagree with the 3 points that I make here. I think we should just move forward with that.
Kevin
--
Kevin Dangoor
work: http://labs.mozilla.com/
email: k...@blazingthings.com
blog: http://www.BlueSkyOnMars.com
Why do you keep lumping these two together?
--
Cheers,
--MarkM
Sorry to be a pain, but people also write mobile-client and desktop
applications in Javascript. I would love to see alignment between
CommonJS and Phonegap (which allows you to build native-featured apps
in Javascript).
That said: Phonegap more or less depends on the iPhone's webkit, so if
you're talking about features of ECMAScript that were deployed in
Safari 3 or so, it would be no problem. I admit that I have not been
paying close enough attention to know whether we're talking about
features that are available "everywhere except IE" or whether we're
talking about features that are not even in Safari yet.
Filesystem access is on the Phonegap roadmap:
http://phonegap.pbworks.com/Roadmap
Paul Prescod
Libraries have always made assumptions about there environment. I wouldn't expect to copy a socket.h library from OS X 10.3 on a PPC to a Debian AMD 64 bit system.The odd duck is that JavaScript lives in environments that are not only different in CPU architecture but also implementation. (Inside or outside the browser, Mac / Win / Linux, ppc, x86, etc.)
ES5 is not yet available in any available browser nor any other
Javascript implementation. Within few months I expect the situation to
be different. But as they say, "prediction is always difficult,
especially about the future."
--
Cheers,
--MarkM
On Fri, Aug 28, 2009 at 4:35 PM, Hannes Wallnoefer<han...@gmail.com> wrote:
> ES5 (minus strict mode, minus bugs) is available in Rhino CVS today,
> thanks to the excellent work of Raphael Speyer.
>
> http://raphscallion.com/blog/
Awesome, I had no idea it had gotten this far. Congratulations Ralph!
Speaking as a Cajadores, this will be quite useful to us immediately.
Thanks!
Cajadores, we should check this into third_party *in addition to* the
ES3ish Rhino we've got so that we can test on both.
--
Cheers,
--MarkM
>> On Thu, Aug 27, 2009 at 12:48 PM, Kris Kowal <cowber...@gmail.com> wrote:>>> [...] so far as that our current implementations fall short of ES5, we are not
>>> compliant.
Ironically, the issue hangs on our recent name change. So long as we
> With the exception of Kris' statement of "we are not compliant" above, I
> don't think I've seen anyone disagree with the 3 points that I make here. I
> think we should just move forward with that.
were named serverjs, if we imagined that we were writing a standard
purely for server-side use where upgrade to new JS versions can be
quick, I think Kris' original language was the right thing. Now that
our name change has clarified our purpose to include browsers, where
we have to assume the normal 5 year lag, I agree with Kevin's
phrasing.
To be more precise, I should have said "conformance test failures"
instead of "bugs", as that is what I was referring to. I've been using
some of the new ES5 features in Rhino and haven't had any problems so
far.
Hannes
> Awesome, I had no idea it had gotten this far. Congratulations Ralph!
> Speaking as a Cajadores, this will be quite useful to us immediately.
> Thanks!
>
> Cajadores, we should check this into third_party *in addition to* the
> ES3ish Rhino we've got so that we can test on both.
>
> --
> Cheers,
> --MarkM
> _______________________________________________
> es5-discuss mailing list
> es5-d...@mozilla.org
> https://mail.mozilla.org/listinfo/es5-discuss
>