While there are certainly times when synchronous calls would have been nice, I recognize that having synchronous behavior for potentially mutable external state also tends to imply a lot about execution order — something that a pure functional language expects to be more free about. Hence, I think it's reasonable to force operations that need to deal with the external world to be asynchronous.
Mark On Fri, Dec 9, 2016 at 7:31 AM Vojtěch Král <[email protected]> wrote: > > > Dne pátek 9. prosince 2016 12:12:43 UTC+1 Rupert Smith napsal(a): > > On Thursday, December 8, 2016 at 5:27:53 PM UTC, Vojtěch Král wrote: > > This resonates with me very much. This is _exactly_ the reason why I made > The Elm Alienation post on Reddit: > https://www.reddit.com/r/elm/comments/5g3540/the_elm_alienation/ > > > If I can quote from that: "In a nutshell, Elm needs unsafe." > > I mostly agree with this, but have some reservations. > > The existing native API is easy enough to figure out, just look at any > 'native' module implementation. Basically you follow the conventions you > see for namespaing you javascript code and wrapping functions with helpers > like F2, F3 and so on, and return an object containing all the functions > you want to expose to Elm. > > Also code does not need to be made asynchronous to be made type-safe, you > could use Result for synchronous calls. Just map all exceptions to Err, and > succesfull calls to Ok. > > It would be nice if we could just mark our own native modules as 'unsafe' > and have an 'unsafe' section on package.elm-lang.org to share them. > > > Yup. I didn't realize Tasks are this async, thanks for pointing that out. > +1 to your email. > > > > > > > > > > -- > > > You received this message because you are subscribed to the Google Groups > "Elm Discuss" group. > > > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > > > For more options, visit https://groups.google.com/d/optout. > > > -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
