-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Next step (based on the incubator call of Aug 10 2020) #41
Comments
I remain strongly against the class approach, and the notes don't make it clear to me what the persuasive argument was (nor what future extensibility you have in mind, or why that extensibility can't be achieved with the function approach). Per the "base class" question you raise, it feels to me like extensibility is harder with a class hierarchy due to the fragile base class problem. New classes shouldn't be callable, since I'd be very interested to see the results of an informed investigation into various designs. |
To extends, means helper methods. Yes, they can be added in the current design but as you can see, it is adding methods on the
If so, I'll choose the 3.i.b (hidden class, exposed create helper) route to make the change (at least for now) so I can bypass the PascalCase requirement (also, at least for now, I'd be able to change if it is found harmful or not welcomed design). |
A When you say "hidden class", if the constructor is reachable, it'd need to have a PascalCase name. If it's not reachable, then it seems like it's just the factory approach, where |
Yes, I have mentioned that "which makes the semantics of helper methods ambiguous. (If we have a .contains(), should it consume the iterator since it is on the iterator prototype?)."
It's not the case. I'm meaning (the second approach): const r = Number.range(0, 1)
const hiddenRangeCtor = r.constructor
assert(hiddenRangeCtor.name === 'NumberRange') // or other name
assert(r instanceof hiddenRangeCtor)
assert(!(r instanceof Number.range)) |
Ah, I see what you mean. In either case, yes, I would assume a generic Thanks, your code sample matches my expectation if we were to go with the class instance approach. Presumably in that case we'd make |
I think it is no harm to get the underlying Range class and construct it manually. My expectation is that: |
@codehag hi! Could you give help to use Cognitive Dimensions of Notation to investigate which semantics is better? Current semantics VS #42. It seems like both Iterator and Iterables have their supporters and it's hard to going on now. |
cc @Felienne This looks interesting. I want to think about it a bit, but wanted to make sure Felienne also saw. |
In the MDN Iterator example the authors aptly named the function From my experience with other libraries: While I think that having an Iterator is a perfectly fine simple step, I think there can be an argument made for a data structure: doing an |
Adding both |
|
One would need to get creative about naming: Aside from this, I still think that there are enough arguments for having an Iterable over a Iterator. |
@martinheidegger i don't agree with that last point; i still haven't heard any arguments that hold. There's lots of discussion about that on #42, though, so let's have that there. |
Reference: https://github.com/tc39/incubator-agendas/blob/master/notes/2020/08-10.md
new
op to create).Array
vsnew Array
)new
the class in the backend.I have no enough free time to work on this these days so sorry for the delay (it's nearly a whole month since the incubator call).
Generally, my next step is to migrate the current design with no observable API style changes (e.g. from
Number.range
tonew Number.range
(and I don't like that)). That means I will choose one of 3.i.a (callable class) or 3.i.b (hidden class, exposed create helper). Please leave comments on which side you'd like to see.The text was updated successfully, but these errors were encountered: