-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarify the syntax of Solidity is not Python inspired #11025
Conversation
docs/index.rst
Outdated
@@ -10,8 +10,8 @@ Solidity is an object-oriented, high-level language for implementing smart | |||
contracts. Smart contracts are programs which govern the behaviour of accounts | |||
within the Ethereum state. | |||
|
|||
Solidity was influenced by C++, Python and JavaScript and is designed to target | |||
the Ethereum Virtual Machine (EVM). | |||
Solidity syntax-wise is a `curly-bracket language <https://en.wikipedia.org/wiki/List_of_programming_languages_by_type#Curly-bracket_languages>`_. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alt: "Solidity is part of the curly-bracket language family."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need the word "syntax-wise"?
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Since it came up that people want to know more about which aspects of Solidity came from where, maybe we should add a section in the documentation about it? |
Sure, but do we have a good list of examples for each of these languages? Actually I think most of the JavaScript influence is gone, so maybe this would be a good place to explain that prior to version 0.4.0, features like scoping and the |
We can create a new global item "influence", listing roughly: Solidity used to be much more influenced by JavaScript in the beginning due to function-level scoping of variables and the use of the keyword Other influences were Python: Solidity's modifiers were added trying to model Python's decorators with a much more restricted functionality. Furthermore, multiple inheritance and the |
Oh, we could also list that |
Really? Trying to decipher when, but the only record we have is #500 (comment) (and seemingly we discussed stuff like |
Maybe I'm mistaken, but I thought I first considered such things after a talk I saw at devcon1 or devcon2. |
By the way, using 'require' for preconditions appears to be from Eiffel's Design by Contract. Any references on that? |
One of the first discussions was #1130 (and apparently here Design by Contract was mentioned, but I don't recall it being discussed beyond that stray comment). There was a very long argument about ensure/expect/require/assume/assert, but it seems we mostly discussed that through calls. We knew we wanted to separate input validation (preconditions) from unexpected behaviour (postconditions/invariants), hence the two keywords. One reference I could find though: #1762 (comment) |
Interesting, so it may have been a decision based on thesaurus results. Love it ;) This link has examples in Eiffel in case you're interested, https://www.eiffel.com/values/design-by-contract/introduction/ |
I just found one more thing borrowed from JavaScript: import syntax and semantics.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine to me if the syntax-wise
comment is addressed
No description provided.