kabiroberai / node-swift

Create Node modules in Swift
MIT License
492 stars 16 forks source link

Support implementing Symbol-based EcmaScript protocols like Iterable #28

Open justjake opened 4 months ago

justjake commented 4 months ago

This adds a set of features that allow Swift developers to implement protocols using Symbols, like Iterable:

Individual commits have some more details.

Discussion points:

kabiroberai commented 4 months ago

hey @justjake, thanks for the PR! Just wanted to let you know that I've given the code a first pass and these look like great changes. I'm a tad busy right now but I'll leave feedback asap, hopefully over the coming week. In the meantime, do you mind splitting up the @NodeName macro into a separate PR? I think that's a slam dunk addition as-is (modulo some nits) and I'd be happy to merge that separately.

NodeIterator also seems very useful but it warrants some thought about whether we should introduce additional layering into this package. So far NodeAPI has largely aimed to replicate the C Node-API surface 1:1. There's definitely room for ergonomics on top of that, but I wonder if we should keep those in a separate module within the package. That could be a good place to move stuff from Sugar.swift et al too.