/irc-logs / w3c / #webapps / 2015-02-25 / end
Options:
Previous day, Next day
- # Session Start: Wed Feb 25 00:00:00 2015
- # Session Ident: #webapps
- # [00:11] * Quits: sicking (~sicking@public.cloak) (sicking)
- # [00:12] * Joins: sicking (~sicking@public.cloak)
- # [00:29] * Quits: sicking (~sicking@public.cloak) (sicking)
- # [00:32] * Joins: sicking (~sicking@public.cloak)
- # [00:46] * Quits: smaug (~chatzilla@public.cloak) (Ping timeout: 180 seconds)
- # [00:57] * Quits: sicking (~sicking@public.cloak) (sicking)
- # [01:01] * Joins: sicking (~sicking@public.cloak)
- # [01:07] * nickstenn is now known as zz_nickstenn
- # [02:04] * Quits: jsbell (~jsbell@public.cloak) ("There's no place like home...")
- # [02:17] * terri is now known as terri_offline
- # [02:18] * Quits: sicking (~sicking@public.cloak) (sicking)
- # [02:28] * heycam is now known as heycam|away
- # [02:41] * Quits: artb (~ArtB@public.cloak) ("Leaving.")
- # [03:48] * heycam|away is now known as heycam
- # [04:14] * Quits: marcosc (~marcosc@public.cloak) (Client closed connection)
- # [04:46] * Quits: tantek (~tantek@public.cloak) (tantek)
- # [05:02] * Joins: marcosc (~marcosc@public.cloak)
- # [05:04] * Joins: tantek (~tantek@public.cloak)
- # [05:09] * Quits: tantek (~tantek@public.cloak) (tantek)
- # [05:38] * Joins: jyasskin (~textual@public.cloak)
- # [06:16] * heycam is now known as heycam|away
- # [06:25] * Joins: chaals (~Adium@public.cloak)
- # [06:32] * Quits: jyasskin (~textual@public.cloak) ("My computer has gone to sleep. ZZZzzz…")
- # [06:38] * heycam|away is now known as heycam
- # [06:49] * Joins: sicking (~sicking@public.cloak)
- # [06:57] * Joins: jyasskin (~textual@public.cloak)
- # [07:03] * Joins: tantek (~tantek@public.cloak)
- # [07:24] * Quits: sicking (~sicking@public.cloak) (sicking)
- # [07:40] * heycam is now known as heycam|away
- # [07:48] * Quits: tantek (~tantek@public.cloak) (tantek)
- # [07:49] * Joins: sicking (~sicking@public.cloak)
- # [08:08] * Quits: marcosc (~marcosc@public.cloak) (Client closed connection)
- # [08:09] * Quits: jyasskin (~textual@public.cloak) ("My computer has gone to sleep. ZZZzzz…")
- # [08:26] * Joins: jmajnert (~quassel@public.cloak)
- # [08:36] * Joins: jyasskin (~textual@public.cloak)
- # [08:39] * Quits: sicking (~sicking@public.cloak) (sicking)
- # [09:09] * Joins: marcosc (~marcosc@public.cloak)
- # [09:16] * Quits: marcosc (~marcosc@public.cloak) (Ping timeout: 180 seconds)
- # [10:38] * Joins: Lachy (~Lachy@public.cloak)
- # [10:40] * Joins: marcosc (~marcosc@public.cloak)
- # [11:46] * zz_nickstenn is now known as nickstenn
- # [11:48] * Quits: chaals (~Adium@public.cloak) ("Leaving.")
- # [12:05] * Joins: chaals (~Adium@public.cloak)
- # [12:24] * Quits: jyasskin (~textual@public.cloak) ("My computer has gone to sleep. ZZZzzz…")
- # [12:42] * Joins: smaug (~chatzilla@public.cloak)
- # [12:45] * Quits: terri_offline (~terri@public.cloak) (Ping timeout: 180 seconds)
- # [13:01] * Quits: chaals (~Adium@public.cloak) ("Leaving.")
- # [13:03] * Joins: chaals (~Adium@public.cloak)
- # [13:28] * Joins: jyasskin (~textual@public.cloak)
- # [13:40] * Quits: chaals (~Adium@public.cloak) (Client closed connection)
- # [13:41] * Joins: chaals (~Adium@public.cloak)
- # [13:43] * Joins: terri_offline (~terri@public.cloak)
- # [13:43] * terri_offline is now known as terri
- # [14:45] * Quits: smaug (~chatzilla@public.cloak) (Ping timeout: 180 seconds)
- # [14:46] * Quits: marcosc (~marcosc@public.cloak) (Client closed connection)
- # [14:53] * nickstenn is now known as zz_nickstenn
- # [15:04] * zz_nickstenn is now known as nickstenn
- # [15:40] * Quits: jyasskin (~textual@public.cloak) ("My computer has gone to sleep. ZZZzzz…")
- # [15:47] * Joins: marcosc (~marcosc@public.cloak)
- # [15:54] * Quits: marcosc (~marcosc@public.cloak) (Ping timeout: 180 seconds)
- # [16:06] * Joins: dka (~dka@public.cloak)
- # [16:19] * Joins: smaug (~chatzilla@public.cloak)
- # [16:49] * Joins: fjh (~fhirsch3@public.cloak)
- # [16:55] * Quits: fjh (~fhirsch3@public.cloak) (fjh)
- # [16:57] * Joins: fjh (~fjh@public.cloak)
- # [16:58] * Joins: fjh_ (~fhirsch3@public.cloak)
- # [17:15] * Quits: fjh_ (~fhirsch3@public.cloak) (fjh_)
- # [17:32] * Quits: smaug (~chatzilla@public.cloak) (Ping timeout: 180 seconds)
- # [17:36] * Joins: marcosc (~marcosc@public.cloak)
- # [17:42] * Joins: bkardell_ (~uid10373@public.cloak)
- # [17:43] * Quits: marcosc (~marcosc@public.cloak) (Ping timeout: 180 seconds)
- # [17:55] * Joins: tantek (~tantek@public.cloak)
- # [18:01] * Quits: dka (~dka@public.cloak) (dka)
- # [18:25] * Quits: chaals (~Adium@public.cloak) ("Leaving.")
- # [18:25] * Joins: chaals (~Adium@public.cloak)
- # [18:37] * Joins: fjh_ (~fhirsch3@public.cloak)
- # [18:57] * Joins: jsbell (~jsbell@public.cloak)
- # [19:00] * Quits: Lachy (~Lachy@public.cloak) ("My MacBook Pro has gone to sleep. ZZZzzz…")
- # [19:17] * Quits: fjh_ (~fhirsch3@public.cloak) (fjh_)
- # [19:24] * Joins: marcosc (~marcosc@public.cloak)
- # [19:32] * Quits: marcosc (~marcosc@public.cloak) (Ping timeout: 180 seconds)
- # [19:49] * Quits: fjh (~fjh@public.cloak) (fjh)
- # [20:15] * Joins: fjh (~fhirsch3@public.cloak)
- # [20:17] * Quits: fjh (~fhirsch3@public.cloak) (fjh)
- # [20:18] * Joins: jyasskin (~textual@public.cloak)
- # [20:31] * Quits: jyasskin (~textual@public.cloak) ("My computer has gone to sleep. ZZZzzz…")
- # [20:35] * Joins: jyasskin (~textual@public.cloak)
- # [20:51] * Joins: sicking (~sicking@public.cloak)
- # [21:04] * Joins: marcosc (~marcosc@public.cloak)
- # [21:12] * Quits: marcosc (~marcosc@public.cloak) (Ping timeout: 180 seconds)
- # [21:31] * nickstenn is now known as zz_nickstenn
- # [21:58] * Joins: shepazu (schepers@public.cloak)
- # [21:59] <shepazu> hey, I could use some WebIDL advice if anyone is around... I have an interface for an object, and one of the attributes takes a function... how do I express that in WebIDL (using Respec, if relevant)?
- # [22:00] <shepazu> would it be EventHandler ?
- # [22:01] <shepazu> or maybe it should be handled as a callback...?
- # [22:05] * Joins: marcosc (~marcosc@public.cloak)
- # [22:06] <jsbell> shepazu: EventHandler is just a particular signature of callback: https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler
- # [22:07] <shepazu> jsbell, so what would you do for this? http://w3c.github.io/web-annotation/api/rangefinder/#widl-RangeFinder-customSelector
- # [22:10] <jsbell> callback CustomSelectorCallback = any (DOMString documentString); interface RangeFinder { ... attribute CustomSelectorCallback customSelector; ... }
- # [22:11] <jsbell> ideally replacing "any" with something more specific, but I don't have enough context
- # [22:11] <shepazu> jsbell, interesting
- # [22:12] <shepazu> jsbell, what does "any" mean here?
- # [22:13] * Quits: marcosc (~marcosc@public.cloak) (Ping timeout: 180 seconds)
- # [22:13] * Joins: elijah (~sid21431@public.cloak)
- # [22:13] <jsbell> http://heycam.github.io/webidl/#idl-any - the function can return anything, no type conversion is specified by the IDL
- # [22:14] <jsbell> http://heycam.github.io/webidl/#idl-callback-functions
- # [22:18] * Quits: jyasskin (~textual@public.cloak) ("My computer has gone to sleep. ZZZzzz…")
- # [22:18] <shepazu> oh, ok... so it could return a Promise, or a RangeFinderResult? http://w3c.github.io/web-annotation/api/rangefinder/#idl-def-RangeFinderResult
- # [22:19] <shepazu> thanks, jsbell!
- # [22:19] <shepazu> jsbell, have we met IRL, maybe at TPAC?
- # [22:20] <jsbell> probably, I'm bad with names. :)
- # [22:21] <jsbell> shepazu: Yeah. But if you know that specifically, you could replace any with (RangeFinderResult or Promise<RangeFinderResult>)
- # [22:22] <shepazu> jsbell, ok, I was just reading that... my understanding of Promises is... terrible
- # [22:23] <jsbell> Unions of (T or Promise<T>) are bad for system-supplied operations (since user code has to probe...) but since this is a user function it might be okay...
- # [22:23] <shepazu> I understood all of those words individually :)
- # [22:24] * Joins: jyasskin (~textual@public.cloak)
- # [22:24] * chaals looks skeptical
- # [22:25] <jsbell> shepazu: an API like: document.getFoo() that returned a Foo or a Promise<Foo> would be a pain to use, since you'd always need to probe the result or always cast to a Promise, e.g. Promise.resolve(document.getFoo()).then(...) anyway
- # [22:27] <shepazu> jsbell, the constraint I'm trying to address is that text-search operations can be somewhat resource-intensive, and I thought maybe a Promise might be a better way to address that...
- # [22:27] <shepazu> but then again, I might simply be talking nonsense
- # [22:27] * shepazu waits for chaals...
- # [22:28] <jsbell> You're right. The question is, should the script's function be forced to be synchronous if it's not intensive.
- # [22:28] <jsbell> er, forced to be *A*synchronous if it's not intensive
- # [22:28] <shepazu> jsbell, yeah, that's the dilemma!
- # [22:29] <shepazu> I want it to be easy to use and intuitive, but need to consider the hard cases
- # [22:30] * Quits: chaals (~Adium@public.cloak) ("Leaving.")
- # [22:32] <jsbell> So, in Service Worker, we have methods like; respondWith(Response or Promise<Response>). This isn't really different; spec-wise, whatever the function returns is wrapped with Promise.resolve(x) which is a no-op if it's already a Promise. (That implies that further process is always asynchronous even if the function returns a non-promise, though, which you probably want anyway for consistency.)
- # [22:35] <shepazu> how far along is ServiceWorker?
- # [22:37] <jsbell> shepazu: large chunks of the API are already shipping in Chrome (stable), more coming in each release. Moz's implementation is fairly far along, dunno what their release plans are. So spec is proven implementable. :) Lots of ongoing refinement, though.
- # [22:38] <shepazu> I wonder if it would work for RangeFinder's timeline... we don't have any implementations yet, or even any commitments, so maybe so
- # [22:40] <jsbell> shepazu: I'm not sure I see the relationship between RF and SW...?
- # [22:42] <shepazu> jsbell, maybe I'm conflating ServiceWorker and worker threads?
- # [22:42] <shepazu> I thought I might take a fire-and-forget approach with RangeFinder
- # [22:42] * heycam|away is now known as heycam
- # [22:43] <shepazu> but I'm probably hopelessly lost at the moment, need more sleep
- # [22:43] <shepazu> heycam, speak of the devil!
- # [22:43] <shepazu> heycam, got time for some RangeFinder advice?
- # [22:44] <shepazu> heycam, specifically, what should I do here? http://w3c.github.io/web-annotation/api/rangefinder/#widl-RangeFinder-customSelector
- # [22:44] * heycam looks
- # [22:44] * Joins: marcosc (~marcosc@public.cloak)
- # [22:45] <heycam> shepazu, what's the question?
- # [22:47] <shepazu> heycam, the attribute takes a function, which right now is defined as a DOMString, which is obviously hideously wrong
- # [22:48] <heycam> shepazu, ah yes :)
- # [22:48] <shepazu> jsbell suggested this:
- # [22:48] <heycam> shepazu, you need to define an IDL callback, which is essentially a function
- # [22:48] <shepazu> callback CustomSelectorCallback = Promise<RangeFinderResult> (DOMString documentString); interface RangeFinder { ... attribute CustomSelectorCallback customSelector; ... }
- # [22:48] <heycam> yes that should work
- # [22:49] <shepazu> and then we discussed how Promises are tricky, and how I don't actually understand them
- # [22:49] <heycam> ha :)
- # [22:50] <jsbell> callback CustomSelectorCallback = (RangeFinderResult or Promise<RangeFinderResult>) (DOMString documentString); - is that too weird?
- # [22:50] <heycam> I think that would be awkward for authors to use
- # [22:50] <shepazu> he said many smart thinks I wish I understood
- # [22:50] <heycam> you'd need to test whether the thing returned was a promise or not
- # [22:50] <shepazu> that's what he was saying...
- # [22:50] <heycam> oh this is for the script author to return something to the RangeFinder, I forgot
- # [22:51] <shepazu> yes
- # [22:51] <heycam> I don't think it makes sense to return a promise here if the rest of your API is sync
- # [22:51] <heycam> e.g. search()
- # [22:51] <shepazu> and I was wondering if maybe search() should be a promise
- # [22:51] <heycam> right :)
- # [22:52] <shepazu> which, again, ugly for devs
- # [22:52] <heycam> uglier would be to make it promise-or-not-promise
- # [22:52] <shepazu> but maybe necessary, given the possible resource-hoggery of searches
- # [22:52] <heycam> do you expect the customSelector functions to take a long time to run?
- # [22:52] <shepazu> maybe always promise?
- # [22:53] <shepazu> heycam, hard to say
- # [22:53] <shepazu> but for long docs... maybe so
- # [22:54] <shepazu> I honestly don't know if RF should be sync or async
- # [22:54] <heycam> I'm not sure either
- # [22:55] <heycam> the documentString that gets passed in
- # [22:56] <heycam> is that the whole document's text?
- # [22:56] <shepazu> heycam, I pay you to know these things!
- # [22:56] <shepazu> heycam, which documentString, the one in the callback? yes
- # [22:56] <heycam> and is it short each time you call search() (so the tail of the document, after the current match)?
- # [22:56] <heycam> yes
- # [22:56] <heycam> *shorter
- # [22:57] <shepazu> well, yes, if .wrap=false
- # [22:57] <heycam> how does the customSelector indicate that there are no more matches?
- # [22:57] <heycam> (well, how does search()?)
- # [22:58] <shepazu> if search() doesn't find anything, it returns null for the range
- # [22:58] <shepazu> and 0 for confidence
- # [22:58] <shepazu> whether that's the last search, or simply an unsuccessful one
- # [22:59] <shepazu> if .wrap=true, then you can keep a list of results, and compare with the first search result
- # [22:59] <heycam> if you want to return null, you should make the type |RangeFinderResult?|
- # [22:59] <shepazu> dunno if that's the best way, but it's what I started with
- # [22:59] <heycam> oh for the Range object inside
- # [22:59] <heycam> ok
- # [22:59] <heycam> either way
- # [22:59] <shepazu> ah, right
- # [22:59] <heycam> then |Range?| for the dictionary member type
- # [23:00] <shepazu> right
- # [23:00] <heycam> anyway, I don't have a good answer about promises or not
- # [23:00] <heycam> but the callback syntax jsbell mentions is right
- # [23:02] <shepazu> ok
- # [23:02] <shepazu> thanks, heycam and jsbell!
- # [23:02] <shepazu> oh, heycam
- # [23:03] <shepazu> you see how ugly my API + ArgsWebIDL is?
- # [23:03] <heycam> oh, the duplication?
- # [23:03] <heycam> yeah there's no good away around that
- # [23:03] <shepazu> I'm using Respec... not sure if I can make it point to the object definitions
- # [23:04] <shepazu> heycam, is that a problem with respec, with webidl, or am I just doing it wrong?
- # [23:04] <heycam> the fact that you have a bunch of dictionary members, then the same things but as attributes in the interface?
- # [23:04] <shepazu> yes
- # [23:04] <heycam> that is just a limitation of webidl
- # [23:04] <shepazu> webidl sucks, then :)
- # [23:04] <heycam> you can't say "insert dictionary members here for all attributes on this interface" for example
- # [23:05] <shepazu> well, so long as I'm not doing it wrong, I guess I'm okay
- # [23:05] <heycam> could make something up for that
- # [23:05] <heycam> not sure how clear it would be to read, though
- # [23:05] <shepazu> heycam, did I make a mistake folding the dictionaries into the interface? should I have kept them separate?
- # [23:05] <heycam> shepazu, not sure what you mean?
- # [23:06] <heycam> by folding in
- # [23:06] <shepazu> and should I define them before or after the interface itself?
- # [23:06] <jsbell> you mean one big webidl block in the spec or many?
- # [23:06] <shepazu> jsbell, correct
- # [23:07] <shepazu> I used the data-merge="RangeFinderResult RangeFinderArgs RangeFinderState" feature of Respec
- # [23:07] <heycam> I think it's fine in one block
- # [23:07] <shepazu> on the interface definition
- # [23:07] <shepazu> ok
- # [23:07] <heycam> the section that describes the dictionary members
- # [23:07] <heycam> seems unnecessary though :)
- # [23:08] <heycam> or you could replace it with a single sentence saying that each one has the same meaning as the corresponding attribute on the interface
- # [23:08] <heycam> or something like that
- # [23:08] <shepazu> heycam, hey, that's what Respec outputs
- # [23:08] <shepazu> heycam, I'd prefer that, but I don't think Respec can do it
- # [23:08] <shepazu> or, I haven't figured out how
- # [23:08] <shepazu> I think I'll try to move it to the end
- # [23:11] * Quits: tantek (~tantek@public.cloak) (tantek)
- # [23:11] <shepazu> this was useful guys, thanks!
- # [23:12] <heycam> np
- # [23:26] * Quits: bkardell_ (~uid10373@public.cloak) ("Connection closed for inactivity")
- # Session Close: Thu Feb 26 00:00:00 2015
Previous day, Next day
Think these logs are useful? Then please donate to show your gratitude (and keep them up, of course). Thanks! — Krijn