[Webkit-unassigned] [Bug 152682] Web Inspector: Show upcoming values of non-native iterators

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jan 4 16:54:55 PST 2016


https://bugs.webkit.org/show_bug.cgi?id=152682

--- Comment #3 from Joseph Pecoraro <joepeck at webkit.org> ---
(In reply to comment #2)
> I think this could backfire if the iterators are not side effect-free. We
> can always do this for native iterators because we know how they are
> implemented.

Correct!

> Perhaps we could hide it behind the getter "eyeball button".

Even this might be difficult. We may need to have some way to duplicate an iterator, as peeking forward will actually advance the iterator and we can't advance the actual iterator without then breaking execution.

--

An entirely alternative solution would be allowing developers to provide their own previews for their own objects. See:
<https://webkit.org/b/142656> Web Inspector: Expose a way for developer provided object previews

I rather like this idea here. The Collections.js object could provide its own JSON preview, which would peek at the next upcoming values.

  class LinkedList {
    constructor() {
      // ...
    }
    get [console.previewSymbol]() {
      // peek at the next values and return something useful
      // for example: return ["one", "two", "three", "..."]
    }
  }

This would replace the Inspector's property based preview with the library defined preview. For iterators in particular we might need to do something extra. Perhaps:

    [console.iteratorPeekSymbol](n) {
      // return the next `n` values
    }

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20160105/937d1fd0/attachment.html>


More information about the webkit-unassigned mailing list