Syntax for the upcoming features (factories, code introspection)

My current approach is:

  • contract interface for ACIs
  • contract for child contracts
  • main contract for main contract

If there is only one contract then it will be turned into main contract. I also stablesort toplevel declarations in the following order:

  • ACIs
  • Namespaces
  • Child contracts
  • Main contract

Implementing truly mutually recursive contracts is a work for a separate task with the current implementation. But keep in mind that these things aren’t consensus affecting so if you don’t like it we can easily make them different

4 Likes

Yet another idea: if there use pragma to define main contract. This could make it easier to switch the compiled contract using simple preprocessor

@main_contract Yanislav
contract Yanislav = ...
contract Vjacheslav = ...

tbh this looks the best for me

Can we please stick to your first idea,

  • contract interface for ACIs
  • contract for child contracts
  • main contract for main contract

The pragma approach brings up some sick old OOP feelings of “decorating” things like java / typescript because their crappy syntax didn’t allow for a more consistent/elegant way of passing contextual information and the other bs they use that for. I prefer the less confusing and clean annotation of

contract...

contract...

main contract...

no need for any extra tokens here imho, let’s keep a clean idea clean :wink:

2 Likes

I agree with this syntax for creation, feels natural to Sophia to my eyes.

1 Like