Additional language features

Christian Mayer mail at ChristianMayer.de
Sat Mar 5 05:41:05 PST 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hello together!

Currently I'm writing a (for me) large project that is heavily using
JavaScript / ECMAScript. During that project I found a few features
missing in the language that could easily be added and where I think
that many programmers could profit from:

1) A printf compatible format string
====================================

For example the String object could be extended by a sprintf type of
function / method that takes a printf compatible format sting and the
additional values. Currently there are lots of libraries that provide
that functionality - but all cover only a small subset and it's not know
which are in good shape or not...

2) A binary type conversion including float
===========================================

My project is using AJAX technology to transmit measurement data over
the net in JSON notation. This data contains IEEE float values, encoding
their bit and byte representation in hex values.
In the browser I need to convert that hex string back into a float value
- - which is quite complicated as I have to implement an IEEE 754 "parser".

Especially for the use with WebSockets it would be a great help to have
a functionality that allows to pack and unpack binary data into
ECMAScript objects.

A possible syntax (and much better description of what I need) give the
"pack" and "unpack" commands in the Perl language.

3) A fast library for small, fixed size vectors (numerical arrays)
==================================================================

For 2D and 3D purposes it would be great to have a data type / object
that is specialized for 2D, 3D and 4D values. It might even internally
map to a SIMD datatype if the CPU running the interpreter is supporting
it (e.g. a SSE type value for x86 processors; other CPU architectures
have similar extensions).
Especially for the Canvas and WebGL it would be great to have such a
data type.

For this data type it would be great to have a library supporting it and
provide linear algebra functionality (matrix multiplication, etc.)
The C++ library Eigen2 provides everything that is necessary (and even
more...)

So I hope I didn't write my ideas to the wrong list (if it is so, please
correct me!). And I hope you can tell me if those additions could make
it on the next spec of ECMAScript.

Thanks,
Christian Mayer

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEAREIAAYFAk1yPXAACgkQoWM1JLkHou25NACdHNkx3GwTMtd34mPtbIunb12G
9VsAoJQMgxluvsNPuRoulnBzsTAap55C
=NbgV
-----END PGP SIGNATURE-----


More information about the es-discuss mailing list