Giter VIP home page Giter VIP logo

Comments (9)

ptal avatar ptal commented on June 25, 2024

Not sure, "catch" really sounds exception-oriented but here it might not be.

from expected.

viboes avatar viboes commented on June 25, 2024

As we have catch_exception that is used also to recover from exception, it seems that recover is to general, and cath_error is more specific.

from expected.

ptal avatar ptal commented on June 25, 2024

Maybe but I don't like much the catch_exception as a member so I wouldn't pay too much attention about it.

from expected.

viboes avatar viboes commented on June 25, 2024

My intention, once we have the monads interface is to remove the definition of the all the functions that can be implemented using the minimal interface. Thus, catch_error, catch_exception, mbind, ... all of them could be removed from the expected interface.

I think that this is the basic idea of splitting Algorithm and Data Structures.

from expected.

ptal avatar ptal commented on June 25, 2024

Ok, I didn't know you wanted to remove that from the interface. But it's right and it's the spirit of the C++ STL. However I'm afraid we'll lose some conveniences without the chaining. Hopefully a binary operator (such as the previously proposed |>) or a construction similar to the do notation would simplify this a lot. Now that I understand your point, I'm ok with the name.

from expected.

viboes avatar viboes commented on June 25, 2024

I have defined the operator &() for mbind and operator |() for catch_error on monads errors. These operators allows to chain as if we used the haskell operators >>= and 'catch_error'

Concerning the do notation, I have added it to the documentation removing the keyword expect.

return auto a <- f :
       auto b <- g : 
       a + b;

from expected.

ptal avatar ptal commented on June 25, 2024

Ok nice, could we extend this to:

auto x = auto a <- f :
         auto b <- g : 
         a + b;

So it could appear outside a return statement.

from expected.

viboes avatar viboes commented on June 25, 2024

The return statement is not part of the do-expression. This was an example. You could even do the following

auto x = (auto a <- f :
          auto b <- g : 
          a + b)
        | recoverHandler;

from expected.

viboes avatar viboes commented on June 25, 2024

4b62de9

from expected.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.