4 ms·
> Why does this require JS (to the point of giving a blank page!) for something that can be trivially done without? This is a slide deck (not a blog post or ar
by mraleph 11y ago
> Why does this require JS (to the point of giving a blank page!) for something that can be trivially done without?
This is a slide deck (not a blog post or article) hence its dependence on JS.
(though even blog posts I write usually depend on JS to provide proper syntax highlighting and diagrams)
> Can someone explain to me why it has to assume that arr.length could change? It states it does, but I don't see why.
If you don't know where `throwConcurrentModificationError(arr)` goes then you don't know what it does, e.g. it can do something like this:
H.throwConcurrentModificationError = function (arr) {
arr.push(10);
};
(contrary to its name - but JITs don't optimize based on names)
That's why JIT has to assume global side effects from the `throwConcurrentModificationError` call - unless of course it emits an unconditional deoptimization right before it which is what happens in the (0, o.f)() case.
- jimktrains2 11y ago> This is a slide deck (not a blog post or article) hence its dependence on JS. That makes it acceptable to not fail gracefully?
- SixSigma 11y agoYes. If I'm doing a presentation using a known browser why do I care about your failures.
- scintill76 11y agoBecause you might end up sharing the URL with people who don't have your "known browser", like the very situation that is prompting this complaint. I get it, whining about graceful degradation and being anti-Javascript can be annoying, but your response is even more so.
- SixSigma 11y agoNo, no, no. Do the right thing for now, not some mythical "what if" situation later that adds premature complification. One should argue that OP should re-write the whole thing in non-slide deck format - TTRWTF
- scintill76 11y agoOK, that's a pretty good point. I still stand by mine as a reasonable, not overly-complicated design goal if I were making a general slides viewer.
- jimktrains2 11y ago> One should argue that OP should re-write the whole thing in non-slide deck format - TTRWTF There are many CSS and JS-based slide decks that degrade nicely. e.g. deck.js (http://imakewebthings.com/deck.js/introduction/deck.html http://imakewebthings.com/deck.js/introduction/deck.html).
- TheLoneWolfling 11y agoAs I said: The only case that arr.length could change, and hence the if statement taken, is if the if statement had already been taken - i.e. arr.length had already changed. This seems safe to optimize. It doesn't matter what H.throwConcurrentModificationError is - it can only be called iff it has already been called. Which means that as soon as you're through the first loop iteration, you know that arr.length hasn't changed that loop, and it won't change any other iterations through the loop. And as for JS - there are plenty of slide decks that work perfectly fine without, or at the very least degrade gracefully. So that's not a good excuse.
- mraleph 11y ago> The only case that arr.length could change, and hence the if statement taken, is if the if statement had already been taken - i.e. arr.length had already changed. Fair point. I misread your original comment. To see this you need a more sophisticated analysis pass than V8 is capable of performing - something similar in spirit to sparse conditional constant propagation, V8's LICM just assumes that all blocks are reachable so it takes the union of all possible side-effects. > So that's not a good excuse. I am not making an excuse, I am simply stating a fact: this is a slide deck, it needs JS to operate. As simple as that. If there is an easy fix - please send me a PR[1], I will gladly take it [1] https://github.com/mraleph/mraleph.github.com/tree/master/talks/goto2015 https://github.com/mraleph/mraleph.github.com/tree/master/ta...