Earlier quoted context omitted.
with (context) + eval = user-space lexical environment ?
No, unfortunately. If a reference isn't found in your context object, it falls through to the ambient namespace. So say you run ... context = { foo: 1, bar: 2 }; with (context) { foo = 2; bar = 3; } That will probably do what you expect. But now say you run it where context is just ... context = { foo: 1 }; with (context) { foo = 2; bar = 3; } ... you might think this would add a 'bar' property to your context object…
A spreadsheet in fewer than 30 lines of JavaScript, no library used
161–170 of 274 posts
Re: A spreadsheet in fewer than 30 lines of JavaScript, no library used
#162Earlier quoted context omitted.
Kinda: http://www.brython.info/index.html
Yeah, I'm aware of this and emscripten. So far, to me, they don't look viable for DOM manipulation.
You really can think javascript and write coffeescript.
Re: A spreadsheet in fewer than 30 lines of JavaScript, no library used
#163Re: A spreadsheet in fewer than 30 lines of JavaScript, no library used
#164Earlier quoted context omitted.
Yeah, I'm aware of this and emscripten. So far, to me, they don't look viable for DOM manipulation.
Consider coffeescript. It does a good job at removing nuisance quirks from Javascript, and adding some python-esque features (sensible looping constructs, list comprehensions, etc.), while maintaining logical equivalence with the javascript it compiles to. (It also mirrors some of the syntactic features of ruby that make that language so appropriate for producing DSLs, which is a feature or a bug depending on your pe…
Re: A spreadsheet in fewer than 30 lines of JavaScript, no library used
#165Earlier quoted context omitted.
A 30 line javascript spreadsheet is similar for me to when I first saw Norvig's 21 line python spelling corrector ( http://norvig.com/spell-correct.html ): this language is more powerful and expressive than I thought. I'm increasingly believing that HTML/CSS/JS in a browser is a viable common runtime. This demo does quite a lot to solidify that belief.
The only things that are powerful and expressive in JavaScript are bastardized beyond recognition versions of ideas from Lisp, Smalltalk and Self. You get those dynamic mechanisms that we know for 50 years now (lambda expressions and runtime method dispatch, oh wow) to be useful but without learning any lessons learned in those 50 years about how to design a coherent language based on those concepts, you just get a h…
Re: A spreadsheet in fewer than 30 lines of JavaScript, no library used
#166I am impressed. Its a neat hack, it actually is a real spreadsheet in 30 lines of code, with references fully working (ie =A3+B4 gives expected output. As does =alert("foo") but then nothing is perfect). I think it says something about the browser as a platform - these thirty lines simply assume an enormous amount that excel and visicalc could not - visicalc had to write their own screen refresh routines. It is usefu…
A 30 line javascript spreadsheet is similar for me to when I first saw Norvig's 21 line python spelling corrector ( http://norvig.com/spell-correct.html ): this language is more powerful and expressive than I thought. I'm increasingly believing that HTML/CSS/JS in a browser is a viable common runtime. This demo does quite a lot to solidify that belief.
This demo is impressive, but apart from the LocalStorage, this exact same code would have worked just the same 15 years ago.
The web has been a great runtime for a long long time.
Re: A spreadsheet in fewer than 30 lines of JavaScript, no library used
#167Earlier quoted context omitted.
The only things that are powerful and expressive in JavaScript are bastardized beyond recognition versions of ideas from Lisp, Smalltalk and Self. You get those dynamic mechanisms that we know for 50 years now (lambda expressions and runtime method dispatch, oh wow) to be useful but without learning any lessons learned in those 50 years about how to design a coherent language based on those concepts, you just get a h…
Imagine if management had not vetoed non "Java-like" syntax's during javascripts creation. Maybe Brendan Eich could have gotten a decent scheme dialect into the browser instead, people could have learned it (because in hypothetical retrospect, what else were they going to do? Not learn it?), and we would be in a far more pleasant position today...
Re: A spreadsheet in fewer than 30 lines of JavaScript, no library used
#168Earlier quoted context omitted.
The only things that are powerful and expressive in JavaScript are bastardized beyond recognition versions of ideas from Lisp, Smalltalk and Self. You get those dynamic mechanisms that we know for 50 years now (lambda expressions and runtime method dispatch, oh wow) to be useful but without learning any lessons learned in those 50 years about how to design a coherent language based on those concepts, you just get a h…
Imagine if management had not vetoed non "Java-like" syntax's during javascripts creation. Maybe Brendan Eich could have gotten a decent scheme dialect into the browser instead, people could have learned it (because in hypothetical retrospect, what else were they going to do? Not learn it?), and we would be in a far more pleasant position today...
Certainly an option; keeping the syntax recognisable helped rather than hindered adoption, which was slow enough as it was at the beginning.
JS+DOM could have lost to Flash rather than vice versa.
Re: A spreadsheet in fewer than 30 lines of JavaScript, no library used
#169Earlier quoted context omitted.
Imagine if management had not vetoed non "Java-like" syntax's during javascripts creation. Maybe Brendan Eich could have gotten a decent scheme dialect into the browser instead, people could have learned it (because in hypothetical retrospect, what else were they going to do? Not learn it?), and we would be in a far more pleasant position today...
They would have learned whatever Java/C-derived scripting language that Microsoft came up with instead.
In order for that to have not happened, it would have had to be so unpopular that Microsoft would decide it wasn't worth adopting, but still popular enough to get Microsoft on board with the general idea. I just don't think that is likely; people would have sucked up a scheme-based javascript even if it was a tad unfamiliar; it was that useful.
(Not to mention, going with the cynical "three E's" theory of 90s Microsoft, they would have at least first adopted it before perverting it.)
I think people overplay the importance of being C-like. AutoLISP hit a bit earlier and found a very strong following in a non-programmer niche. People doing web development were already fucking around in HTML of course, so clearly they could wrap their heads around things over than curly braces.
Re: A spreadsheet in fewer than 30 lines of JavaScript, no library used
#170I am impressed. Its a neat hack, it actually is a real spreadsheet in 30 lines of code, with references fully working (ie =A3+B4 gives expected output. As does =alert("foo") but then nothing is perfect). I think it says something about the browser as a platform - these thirty lines simply assume an enormous amount that excel and visicalc could not - visicalc had to write their own screen refresh routines. It is usefu…
A 30 line javascript spreadsheet is similar for me to when I first saw Norvig's 21 line python spelling corrector ( http://norvig.com/spell-correct.html ): this language is more powerful and expressive than I thought. I'm increasingly believing that HTML/CSS/JS in a browser is a viable common runtime. This demo does quite a lot to solidify that belief.