Functional equivalent of decorator pattern?

后端 未结 10 2111
悲&欢浪女
悲&欢浪女 2021-02-02 06:34

What is the functional programming equivalent of the decorator design pattern?

For example, how would you write this particular example in a functional style?

10条回答
  •  离开以前
    2021-02-02 07:22

    I'm not 100% sure but I think the C9 lecture series on advanced functional programming explains the problem really good.

    Aside from this you can use just the same technique inside F# (it supports just the same OO mechanism) and in this special case I would do so.

    I guess it's a matter of tast and the problem you are trying to solve.

提交回复
热议问题