brawer / proposal-intl-displaynames

A template for ECMAScript proposals
MIT License
3 stars 2 forks source link

Why is this API "batched"? #9

Open domenic opened 6 years ago

domenic commented 6 years ago

It seems like a more natural API would be to take a single second argument, and allow people to use .map, instead of doing the batching for them. E.g. instead of

let langs = getLanguageDisplayNames(["pl"], ["fr", "de", "en", "sr-Latn-XK"]);

you'd do

let langs = ["fr", "de", "en", "sr-Latn-XK"].map(
       displayLang => getLanguageDisplayName(["pl"], displayLang)
   );
FrankYFTang commented 5 years ago

I believe internally inside the implementation, there will be overhead to load the 'pl' resources, and therefore will be more efficient to resolve all the languages in a batch instead of loading / unload the 'pl' resources every time.

littledan commented 5 years ago

@FrankYFTang I'd expect so as well, but there are alternatives to that, e.g., https://github.com/brawer/proposal-intl-displaynames/issues/4

FrankYFTang commented 5 years ago

@domenic I am taking over the champion of this proposal now. Somehow, as a novice of github I messed up the transfer process and use a different process that won't carry all the fired issues to https://github.com/tc39/proposal-intl-displaynames. Could you refile your issue in https://github.com/tc39/proposal-intl-displaynames/issues ? Check my two proposed changes on https://github.com/tc39/proposal-intl-displaynames/pulls first. I think that address the issue you have here. I would like to ask to abandon this old one but move all discussion to https://github.com/tc39/proposal-intl-displaynames/issues instead.