Closed cag closed 7 years ago
Updates from Slack:
stefan.george [5:49 AM] @ alanlu @ mike
Solidity docs do not suggest any naming restriction wrt contracts and filenames.
From truffle docs: http://truffleframework.com/docs/getting_started/compile#convention
...
alanlu [11:01 AM] @stefan.george Wow, I was looking for that! Well, that is strictly on the Truffle side of things, and as I understand it, imports in Truffle are understood differently from imports in Solidity, which came after the feature was implemented in Truffle. Looks like I am mistaken, though the import semantic differences between vanilla Solidity and Truffle-flavored Solidity should be addressed. I will copy this over to the issue I posted.
All of those issues are Truffle restrictions, and not related to the version of solidity. Upgrading solidity won’t fix those directly (although we might be able to use 0.4.9’s new output structure to fix some or all of these issues).
This is on my near-term roadmap. The restriction that a contract name must match the filename is an old restriction from the early days of Truffle, and should be able to be safely removed now.
I'm going to rename this to "Remove restriction that contract names must match file names"
mike [6:10 PM] @ alanlu this is a solc bug. Fixed in 0.4.9.
Let me rephrase the above: Mike was mistaken - it's not a solc bug, but solc 0.4.9 might let us fix it.
I'm wary of upgrading to solc 0.4.9 given that I've been told "there's issues", mostly by @pipermerriam, and the last thing I want to do is release those issues onto Truffle users. I hope to better evaluate it soon.
Thanks for the clarification. This probably belongs more in the main truffle repo issue tracker then...
Though I've noticed that the update wasn't #pragma
'd in the AbstractToken.sol
containing Token
, so it is very possible that 0.4.9 is not necessary for fixing this issue.
This restriction has been removed in 3.1.9 beta. Your feedback welcome. More details here: https://github.com/ConsenSys/truffle/releases/tag/3.1.9
Note that it was a quick beta release (getting on a plane today) so if you can try it out for your context that'd be great. Remember: Betas are supposed to bake. The cooking time on this one might be a week or two. Would love for you guys to try out the use case again above with the new beta and tell me what you think.
solc 0.4.8
has some issues with source files which do not contain a contract or library with the same name as the filename. I recommend bumping the version ofsolc
From ConsenSys slack: