fantasyland / fantasy-land

Specification for interoperability of common algebraic structures in JavaScript
MIT License
10.13k stars 376 forks source link

Why name the Comonad method "from"? #72

Closed bergus closed 9 years ago

bergus commented 10 years ago

I did like the name extract that was proposed in #57 much more. Why was from chosen?

To me (and probably most other people who don't know what comonads are about), extract is more descriptive and meaningful. Don't we want a self-explanatory spec? It matches the Haskell function as well.

Also, I have some reservations against using from. The term is used in ES6 for static (constructor) methods to assimilate values in a type, e.g. Array.from. Don't we expect some collisions, especially since from originally had a static counterpart (7253b836d86ecc434bcd9775255646b8001fec72)?

Sorry for not bringing this up earlier, I seem to have forgotten to watch this repo.

joneshf commented 10 years ago

Well, I think there's a couple things going on here:

  1. Most of us don't actually care what the name is, since names don't actually tell you anything about implementation. Case in point, I didn't know what es6's Array.from did until I read about it.
  2. I don't think we were thinking about es6 when the PR was going on. We should pay more attention in the future.

Do any of the other builtin types use from or extract?

We could also call it coof if we want to limit collisions :)

Let's hear back from some others and make a decision.

bergus commented 10 years ago

from is inherited by all Array subclasses, notably the typed arrays have an own implementation. extract is nowhere used.

5outh commented 9 years ago

@bergus I named it from because return was renamed to of, and from seemed to match that convention slightly better. I think that extract is a good name as well and wouldn't mind seeing it renamed. I didn't realize there was an ES6 collision either, good find!

SimonRichardson commented 9 years ago

Can we close this one, or create a PR with suggested fixes?

bergus commented 9 years ago

@SimonRichardson: Done :-) I don't have much experience with Github's online edit interface, so I might have done something odd (please hint me).

SimonRichardson commented 9 years ago

Closing, as it's been merged. Congrats!

5outh commented 9 years ago

Thanks @bergus :+1: