+1 Peter

Elm forces you to explicitly handle failures - whereas you in many other
languages the use of exception handling is optional.

this freaks some people out, because it's so deeply baked in, that they can
miss it's there at all : )

On Fri, 7 Oct 2016 at 09:32 Peter Damoc <pda...@gmail.com> wrote:

> On Fri, Oct 7, 2016 at 5:13 AM, Dave Ford <df...@smart-soft.com> wrote:
>
> So, based on my understanding, the whole "no runtime exceptions" concept
> is just not computing.
>
> But I am new to Elm. Surely I am misunderstanding something. Please tell
> me what I am missing.
>
>
> Programs will always have code that could rise "exceptions" or errors.
> A runtime exception is a kind of exception that bubbled up to the surface
> and causes the application to either crash or end up in an unstable state.
> No one wants these kind of exceptions.
>
> No, back to you example.
> It is very useful that you said that  "It's kind of like having two
> returns" because that is a GoodThingâ„¢!
> Elm makes this explicit.
> In Elm, in those cases, you return a type that can have 2 kinds of values:
> a success value and a failure value.
> You can either return a Maybe (a simpler type where on failure you just
> say that it failed) OR you can return Result (a more sophisticated type
> where failure has its own informative type).
>
> You will have to handle ALL these failure values, even if it is just to
> silence them by unpacking the Result or Maybe using a default value
> (Result.withDefault and Maybe.withDefault).
> This means that there is no exception that will bubble up unhandled at
> runtime and crash your app.
>
>
>
> --
> There is NO FATE, we are the creators.
> blog: http://damoc.ro/
>
> --
> 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 elm-discuss+unsubscr...@googlegroups.com.
> 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 elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to