New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Discussion: API Changes for Hopac 1.0 #147
Comments
I agree with deferring the scheduler to v2 |
Hello, I am speaking as a potential user : I have not used Hopac but I read all the documentation I could find to grasp the project (I just don't have a use case currently).
It would clearly lower the barrier of entry (at last for me : an F#_but_never_Haskell developer :) ) |
What are the reasons for wanting to removing the Scheduler from the design? Or could you please link to the discussion if it is too complicated to summarize?
I agree. It also would not hurt if the types and functions were written out. E.g. This is how I would describe their semantics and name them (based on my limited understanding of their semantics so far, so they may be way off, but you get the idea):
I think these new names differentiate the different semantics and describe their intended usage pretty well (assuming I do not misunderstand their semantics). You could created type synonyms for the old names to avoid breaking all code, but let new users benefit from the more descriptive names. Maybe also come up with an unambiguous name for Disclaimer: I do not have any practical experience with Hopac (or any another implementation of CML) so far. I have not read the book on CML, but I am familiar with the related concepts in Go and Clojure's core.async. At this point I am just trying to roughly understand how Hopac is similar/different and what the API provides out-of-the box. My current (limited) understanding of Hopac is only based on reading Hopac's documentation including its guide, reading the descriptions of types in the reference in addition to reading @neoeinstein's excellent introduction and presentation. |
-1 for the renames @21c-HK suggests. I also disagree with the justification; there's no good auto-complete for huge F# projects in Ionide, so I type the Hopac functions and types all the time. I think this project shouldn't focus on making it easier to understand, but making it easier to get started and find documentation and experimenting. Perhaps we can compile to wasm? |
Yes I agree with @haf. Nearly all the names @21c-HK proposed are more intimidating, longer, not actually any clearer. The only names that could possibly change are IVar and MVar. IVar presumably isn't an interface so that's a bit confusing. MutVal<'X> ImmVal<'X> might be a bit clearer while still being not any longer than Promise. |
Perhaps having |
I think bind is fine. If you want to improve ease of use focus on exposing computation expressions in documentation. Most F# programmers are at least experienced in consuming CE's. |
I'd like to push toward a stable 1.0 API for Hopac. Much of the API looks good and is relatively stable, but there may be some changes that we can make before a 1.0 release that can improve the usability of the API. Below are a couple of my ideas.
Rollback use of constructors for
Promises
andIVar
and some others, preferringcreate
/createFull
/createFailed
functions.The idea of removing
Scheduler
from the design has been previously discussed. I am not sure quite where to start to do this, but it may be better to reserve for a possible 2.0.Move away from functional jargon names or add functions that have more names that are more "friendly" to new users. Taking a page from Elm, possibly introduce
andThen
as a synonym forbind
.It is too easy to use
Alt.prepare
incorrectly, often doing synchronous work (or worse, waiting on jobs synchronously) before returning theAlt
. Instead users that need to do asynchronouse work before anAlt
is ready should be creating aPromise
(throughmemo
, for example) so that theAlt
can finish instantiation and then continue to instantiate otherAlt
s in achoose
block. Possibly add documentation to the variousAlt
functions and/or add other functions intoAlt
that provide the intended functionality (even if simple synonyms to existing functions).Harmonize the names of
Job
/Alt
/Promise
functions that returnunit
, a constant, an exception, and that never return.Each of these and more may spawn additional tickets, but I wanted to get some feedback before I go running off with this.
The text was updated successfully, but these errors were encountered: