pontem-network / dove

🛠️ Diem/Pontem Move package manager
MIT License
35 stars 13 forks source link

Feature request: conditional compilation #145

Closed villesundell closed 3 years ago

villesundell commented 3 years ago

Hello! Recently the Diem Association (read: Facebook :laughing: ) has been very interested to expand Move support to platforms such as NEAR (in fact, directly sponsored by Facebook).

This can lead to a situation, where a feature (for example: retrieving current time) can be implemented differently on Diem, Pontem and NEAR (since that would be platform specific, not language specific).

So, I would like to request a feature that would permit compiling different files if on a certain platform, and would also include (and exclude) some dependencies accordingly.

For example:

(Of course all of this would be project specific, and defined in Dove.toml.)

RIg410 commented 3 years ago

Thank you for contacting us. I think it will be useful. But I would not like to do this at the file name level.

I'd like to see something like:

#![dialect(pont)]

module Helpers {

}
#![dialect(diem)]

module Helpers {

}

What do you think about this? And you will also be able to store these modules in DiemHelpers.move and PontemHelpers.move.

boozook commented 3 years ago

Hi Ville 👋 Thanks for your proposal. We already have think about it and discussing a little better implementation :) .

villesundell commented 3 years ago

Thanks guys, once again :slightly_smiling_face: Yes, conditional compiling by #![dialect(diem)] instead of defining those in Dove.toml makes sense :+1: