flintrocks / flint

The Flint Programming Language for Smart Contracts
MIT License
2 stars 0 forks source link

Map Flint types to Solidity in external calls #94

Closed nvgrw closed 5 years ago

nvgrw commented 5 years ago

Closes #90

See description of ticket.

nvgrw commented 5 years ago

With the mapping that we had originally planned, types such as Bool and String overlap each other and require either unnecessary post-processing (after the AST) or parse-time disambiguation by keeping track of the context. Neither of these solutions are very clean, so I went with the simplest thing I could think of: I've lowercased all of the types. Semantically they are only allowed to occur in contexts where we call into solidity so I actually think in some ways this makes it more clear.

external trait SomeContract {
  func someFunction(aString: string, anInt: int40)
}

// later
call! sc.someFunction(aString: myString as! string, anInt: myInt as! int40)