An article comparing JScript and VBS got me some ideas about what I think should be added to JS 1.6.
I like the Date object in JS but it needs a lot of improvements. These following things are really missing:
- Localized weekday name
- Localized month name
- Week start day
- Week number (localized because it is not the same all over the world
parseis totally useless because it only accepts US date format. It should allow a localized date string and take second argument containing the pattern.
- There should be a way to get the pattern, much like how SimpleDateFormat works in Java.
We definately need a format method that works much like
printf in C and the
% operator in Python. This one should work with the date time format mentioned above.
There is also a need for a
StringBuilder class since concatenation is too slow to do on imutable
String objects. This is easy to implement in JS but letting the host environment implement this could improve performance quite a bit.
See Array Extras.
These methods should also work on hashes (
Object) and other collection like objects like the DOM
- There is often a need for a
toHashCode()method that returns a unique id of the object
- Getters and setters (Mozilla has these in JS1.5) but they need to be widely supported to allow real world usage
- Marking fields as enumarable or not. ActionScript has had this for a long time.
- A way to override the
operator. I mean right now there is no good way to extend
Objectto make it behave like a collection without adding a method.
- Constants like in JS1.5
for eachloops that loops over the elements in an
Arrayand the fields in an
Object. (E4X really blew it here and broke the for in loop semantics.)
withsince it is really bad in dynamic lanugages
- Add tuples support
- Fix the
constructorproperty so that it points at the constructor used to create the object.
- Allow sub classing of built in objects like
Dateas well as DOM objects. Just imagine being able to create a class that extends
yield/generator support like in Boo or Python.