tact icon indicating copy to clipboard operation
tact copied to clipboard

Proposal on extending the mechanism of imports

Open anton-trunov opened this issue 1 year ago • 2 comments

Tact should support importing external libraries like most programming languages.

Your ideas are very welcome!

Tagging @talkol, since you expressed interest in this :)

anton-trunov avatar Feb 20 '24 13:02 anton-trunov

External imports is a tradeoff - you make it easier to bring dependencies, but you're more prone for dependency hell and hiding from users what's actually being imported. In some extremes like NPM, this creates node_modules with hidden dependencies of 2GB and minor versions updating in sub dependencies without anyone noticing.

I think that for smart contract development, this tradeoff is more negative than positive, so I'm personally against this feature.

When a user decides to use a contract, it should be very clear exactly what code they're dealing with because there's money at stake. I think it's more prudent for the developer to manually bring the dependencies inside their codebase. This makes the developer take full responsibility and be aware of exactly what code goes into their contract.

talkol avatar Feb 21 '24 09:02 talkol

One idea I had is to extend the capabilities of an import statement to allow cherry-picking of what's being imported and what is not. But it seemed unnecessary complex to implement for the little value it provides, as it's way easier with contract code (compared to conventional programming languages) to simply re-organize contents of the imported .tact or .fc files and cut away at any unnecessary things that way.

Which also makes me lean towards @talkol's conclusion: it's probably better for the developer to manually bring the dependencies into their codebase. It may be an UX drawback, but it's a long-term win for security and asset management of the contracts.

novusnota avatar Feb 28 '24 16:02 novusnota

Closing this for now. We might return to this issue in the future

anton-trunov avatar Jun 12 '24 05:06 anton-trunov