RE: Using objects for a mapping argument

From: Jeffrey Yasskin [mailto:jyasskin@google.com] 

> The API I'm suggesting looks like:

Your approach seems good then; we should make it work.

> I dealt with users overriding the builtins using a paragraph at https://webbluetoothcg.github.io/web-bluetooth/#terminology saying that when the spec uses a name like `BluetoothUUID.getService`, that has to be interpreted as referring to its original value, not anything the user has set it to. I figure it's silly to force specifications to use a parallel library that people have to learn separately from the built-in JS library.

I think we should not do this. It's not silly to separate the internals from the author-exposed algorithms. They have very different behavior, e.g. they operate on different types, leading to the confusion we see with sequences vs. arrays. 

> I'm just using the array methods to map a function over a sequence. In at least one place, I forgot and just wrote a_sequence.map(). Have other specs picked a different convenient way to say that?

Arrays aren't sequences, as Boris pointed out, so this just doesn't work; the spec is incoherent as of now.

You should do something like create a new sequence, loop over the old one, and add an element to the new sequence whose value is the result of applying the algorithm to the item from the original sequence.

Received on Tuesday, 27 September 2016 14:08:42 UTC