How to organize F # and C # side by side

The project I'm working on should be migrated from C # to F # based on the fact that tomorrow will bring food on the table - in other words, these two languages ​​should live side by side in this project for many years.

The problem that I face repeatedly is how I should organize projects in the solution to meet this need.

I kept translating fragments from C # to F # all the time, because it often reduces development time and improves quality. But I get C # code that wants to use F # code, and F # code that want to use C # code, at the same level or at the borders between layers or modules. I find that I put the code in the wrong projects to avoid creating another project at some level.

The situation is not bad now, but I'm worried that at some point I will paint myself in the corner if I can’t come up with a template or structure or just better understand the problem.

Is there any modification to the normal F # architecture — a template, substructure, or add-in that works well for such a mixed solution?

Are there patterns that are known to be especially useful in solving this particular problem?

+4
source share
1 answer

Use the interface to communicate between the two languages.

Typically, when porting f # is a lower level dll, while C # can call f # as usual.

, f # #, f # dll (, IClibApi), # (, ConcreteClibApi IClibApi). ConcreteClibApi f #. f # # IClibApi.

ConcreteClibApi:)

+6

Source: https://habr.com/ru/post/1672437/


All Articles