I'd say the best way is to just file an issue. -----
Isiah Meadows [email protected] www.isiahmeadows.com On Sun, Jan 20, 2019 at 3:59 AM Sm In <[email protected]> wrote: > Thank you for answer, I've checked thart proposal before. > As I know, proposal-pattern-matching contains guards(which checkes value's > property) > > Yes, this proposal's new sementic seems duplicate pattern match's guard. > But, As I know, the guard can be associcated with only one pattern. > here is an example from proposal-pattern-matching: > > ```js > > const res = await fetch(jsonService)case (res) { > when {status: 200, headers: {'Content-Length': s}} -> { > console.log(`size is ${s}`) > } > when {status: 404} -> { > console.log('JSON not found') > } > when {status} if (status >= 400) -> { > throw new RequestError(res) > } > } > > ``` > > Okay, looks fine, but how about when we want to send different error when > error code is 5xx? > do I have to do this? > > ```js > > const res = await fetch(jsonService)case (res) { > when {status: 200, headers: {'Content-Length': s}} -> { > console.log(`size is ${s}`) > } > when {status: 404} -> { > console.log('JSON not found') > } > when {status} if (status >= 400 && status < 500) -> { > throw new RequestError(res) > } > when {status} if (status >= 500) -> { > throw new InternalServerError(res) > } > } > > ``` > > Humm, this looks odd, we duplicate `when {status}` twice! > so, I can say: "pattern matching is good at checking value's structure. > checking it's property is small option." > > I don't know which one is better choice, pushing this proposal or add this > problem as issue to proposal-pattern-matching(they have [some plans]( > https://github.com/tc39/proposal-pattern-matching/blob/latest/TO_INFINITY_AND_BEYOND.md) > for future, and this can be merged into there). > and creating genenral syntax or creating specific syntax in order to solve > problem. > > please help me to figure out in this problem :)) > _______________________________________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss >
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

