www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: emscripten

reply bearophile <bearophileHUGS lycos.com> writes:
Adam Ruppe:

 Which brings me to emscripten... it most certainly does not work well! The
Python
 example took a couple *minutes* to load for me, and actually running some
python
 code took seconds each time.

On a more modern browser it works "well enough" (Firefox 4). Do you realize that the source code of CPython is a LOT of code, we are talking about a JavaScript source file of 2.6 MB, after compression! So just seeing it compile and be able to run it and run some Python scripts is a marvel for me :-) So I think emscripten is a very nice toy. I have not yet tried to use LDC & emscripten to convert some D1 code to JS. Regarding the JavaScript language, they are going to fix some of its biggest mistakes (but not semicolons yet, hopefully later), so JS is gaining speed, fixing its mistakes, and gaining power (canvas, WebGL, audio, video, other widgets, frameworks, etc): http://www.yuiblog.com/blog/2010/12/14/strict-mode-is-coming-to-town/ An interesting part from that blog post, that reminds us that D2 has sadly failed to fix this problem (and the octal!x syntax is not a significant improvement of the situation):
In C, an extremely unfortunate representation of octalness was selected:
Leading zero. So in C, 0100 means 64, not 100, and 08 is an error, not 8. Even
more unfortunately, this anachronism has been copied into nearly all modern
languages, including JavaScript, where it is only used to create errors. It has
no other purpose. So in strict mode, octal forms are no longer allowed.<

Bye, bearophile
Dec 19 2010
parent reply Adam D. Ruppe <destructionator gmail.com> writes:
bearophile:
 On a more modern browser it works "well enough" (Firefox 4).

This is a bit of a rant, but I hate how the web community always uses "modern browser" like this. I ran this site on Firefox 3.6.3. The most recent one it offers on getfirefox.com is 3.6.13 - I'm not very far behind! My about firefox box says Gecko from April 2010. That should be modern by any sane definition! (Now, my every day browser, Konqueror 3.5.7, is (c) 2005. So I can understand it not being a "modern browser". But it works for me so I won't change it. Something I find hilarious though: it's CSS2 compliance was better than firefox up until about last year! I just wrote a site going wild with css for a web demo for the company, and it worked almost as well in my old Konq as it did in my newer Firefox. The kde folks did a really impressive job there.) Anyway, it just irks me that so many web evangelists say "modern" when they really mean "bleeding edge". And in Google's case, it is even worse: when they say "all modern browsers", they actually mean "/our/ bleeding edge beta". It really annoys me. Back on topic:
 So I think emscripten is a very nice toy.

I agree completely, it's a cool toy and pretty impressive that they got it to work as well as they did. I just don't think it is usable or really desirable for real work. Maybe it will improve, but it still has to compete with straight up javascript, which is already good enough for most places where you really need it.
 Regarding the JavaScript language, they are going to fix some of
 its biggest mistakes (but not semicolons yet, hopefully later),

Interesting. Some comments from the article, then back to you to comment on octal! at the end: "Strict mode requires that all variable binding be done statically." I wonder how that will change the javascript "this" keyword. I originally found it confusing, but now that I know its rules it isn't so bad and is sometimes extra useful. "You should explicitly declare all of your variables." "Should"?? If this is actually a strict mode, shouldn't it be "must"? Maybe the author is just being sloppy, but this wording makes me think it moved from implicit global to implicit local. Definitely better, but still requiring "var" in all cases is better yet. "Noisy Failure" Something important about failure is it isn't just the language. The environment needs to tell you too. Browsers often either hide errors or annoy you so much about them you want them hidden. Some support an onerror event so you can hook it yourself, but not all browsers do. It would be nice if the browser behavior on error in strict mode was improved too. ...or better yet, give us a compiler ahead of time! JSLint is OK I guess though, but I rarely use it. "There are still problems in JavaScript that strict mode does not address." Yes, and those things still suck. But if you use js sparingly, you don't have to deal with them too much. :) Back to bearophile:
 (and the octal!x syntax is not a significant improvement of the situation):

Sure it is! The problem is that the old syntax is still accepted instead of either breaking C or giving a compiler error. This is one place where Walter and I disagree, but to move to a new way, we eventually need to remove the old way.
Dec 19 2010
next sibling parent Lutger Blijdestijn <lutger.blijdestijn gmail.com> writes:
Adam D.  Ruppe wrote:

 bearophile:
 On a more modern browser it works "well enough" (Firefox 4).

This is a bit of a rant, but I hate how the web community always uses "modern browser" like this. I ran this site on Firefox 3.6.3. The most recent one it offers on getfirefox.com is 3.6.13 - I'm not very far behind! My about firefox box says Gecko from April 2010. That should be modern by any sane definition! (Now, my every day browser, Konqueror 3.5.7, is (c) 2005. So I can understand it not being a "modern browser". But it works for me so I won't change it. Something I find hilarious though: it's CSS2 compliance was better than firefox up until about last year! I just wrote a site going wild with css for a web demo for the company, and it worked almost as well in my old Konq as it did in my newer Firefox. The kde folks did a really impressive job there.) Anyway, it just irks me that so many web evangelists say "modern" when they really mean "bleeding edge". And in Google's case, it is even worse: when they say "all modern browsers", they actually mean "/our/ bleeding edge beta". It really annoys me.

I'm more used to the term in "every modern browser, except IE", in which case it is usually correct and modern means something from this or last year (except IE). Good old Konq from 2005 for example has better CSS2 support than IE8.
Dec 19 2010
prev sibling parent "Nick Sabalausky" <a a.a> writes:
"Adam D. Ruppe" <destructionator gmail.com> wrote in message 
news:ieleht$1qc8$1 digitalmars.com...
 bearophile:
 On a more modern browser it works "well enough" (Firefox 4).

This is a bit of a rant, but I hate how the web community always uses "modern browser" like this. I ran this site on Firefox 3.6.3. The most recent one it offers on getfirefox.com is 3.6.13 - I'm not very far behind! My about firefox box says Gecko from April 2010. That should be modern by any sane definition! (Now, my every day browser, Konqueror 3.5.7, is (c) 2005. So I can understand it not being a "modern browser". But it works for me so I won't change it. Something I find hilarious though: it's CSS2 compliance was better than firefox up until about last year! I just wrote a site going wild with css for a web demo for the company, and it worked almost as well in my old Konq as it did in my newer Firefox. The kde folks did a really impressive job there.) Anyway, it just irks me that so many web evangelists say "modern" when they really mean "bleeding edge". And in Google's case, it is even worse: when they say "all modern browsers", they actually mean "/our/ bleeding edge beta". It really annoys me.

Hear, hear!
Dec 19 2010