CatalaLang / catala

Programming language for literate programming law specification
https://catala-lang.org
Apache License 2.0
1.99k stars 77 forks source link

C backend : generate deep copy functions for user-defined types containing boxes #677

Open denismerigoux opened 2 months ago

denismerigoux commented 2 months ago

Since values returned by Catala functions can contain boxes in the C backend, the user cannot clear the Catala memory allocation because it would free the boxes in the return values they want to use.

This should be fixed by providing generated deep-copy functions (that use malloc instead of the Catala allocator) such that the user can copy interesting values outside of the Catala-managed memory.