4

are monads, or more specifically f# computational expressions, a form of aspect oriented programming?

Update:

f# workflow builders have methods other than bind and unit. They have hooks for lots of keywords. see Creating a New Type of Computation Expression.

0

2 Answers 2

6

To the extent that monads serve to isolate a generalized computation strategy from the specifics of its algorithm or implementation, they can be seen as a basis or theoretical foundation for AOP. I found an interesting paper called Monads as a theoretical foundation for AOP (PDF) that gives this idea a more thorough treatment.

5
  • ugh, am I going to have to learn scheme too? I already feel like I need to learn Haskell just to learn about functional programming. LOL. /end rant May 11, 2011 at 22:40
  • 1
    Learning new languages is fun! May 11, 2011 at 22:45
  • 1
    After you have the first one down, yes. When you are trying to learn a new programming paradigm, one is enough. I will have to add, functional programming seems more 'natural' to me somehow. I'm starting to get frustrated with c# and what it can't do, the more I work with f#. May 11, 2011 at 22:51
  • You only really need to grok the syntax to follow the examples. May 11, 2011 at 23:03
  • well I guess i need to spend an afternoon learning scheme, so i can 'grok the syntax' May 11, 2011 at 23:10
1

for me it somewhat feels a bit like AOP. Classic example in my work is using a "log-Workflow" (better known as a state-monad with the state beeing a log-entry) for loging inside my F#-code to spare me from passing the log-object through every method-call. On the other hand "real" AOP doesn't need you to write log-code inside your methods at all (maybe some attributes). I don't like the "hey I rewrite your code for you"-AOP frameworks so I just use Unity-Injection from time to time (yes I really use Unity - does everything I want from it) and it's ok.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.