-
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
Standard library #10282
Comments
I think an option to export the stdlib to the filesystem could be a nice addition to the commandline: |
Should we create a base class "TokenOwner" that has functions to transfer tokens? Is this a standard somewhere? |
What is that exactly? However we said not to include ERC standards in this library, at least not at the start, but rather focus on moving parts of the compiler out. |
A wider range of type casting options would be wonderful. |
@kfichter Lately we've actually been making type casting stricter and more explicit. What would you suggest could be improved? |
@leonardoalt honestly the more I think about this, the more it seems like the sort of type casting I'm interested in is probably beyond the requirements of a stdlib. Probably better for this sort of stuff to live in a different (but standardized) library. |
Although other common operations like |
In #9358 (comment) there was as suggestion for other special namespaces like |
One thing that might be useful in stdlib is the equivalent of I've seen an OZ issue about string utils where the topic of concatenating strings came up and something like this was suggested: string(abi.encodePacked(partOne, Strings.toString(numberTwo))) with string(bytes.concat(bytes(partOne), bytes(Strings.toString(numberTwo)))) but that's even longer than the original. Would be nice to have string_concat(partOne, Strings.toString(numberTwo)) |
It's still not totally clear to me how the import mechanism works. I created a hackmd note to discuss: https://notes.ethereum.org/@solidity/r1lNFFdjec |
Since this has been a bit stalled, perhaps the best way would be adding a new experimental flag to the compiler (either This way we could merge functions step-by-step even before we get generics supported. |
Based on the internal architecture of |
Copying the (I think) "decisions" from there:
|
Experimented with this a idea a bit, pushed the work here: https://github.com/ethereum/solidity/tree/stdlib2 I think this is workable, we can slowly introduce parts of the stdlib without waiting for all the needed language features to be present. This will mostly be enough to allow globals, and potentially some member functions (with |
Created https://github.com/ethereum/solidity/projects/46 to group the required/considered features. |
Moved some of the example code we had lying around to https://notes.ethereum.org/@solidity/Sy03Y8_c5 (most of this is incomplete) |
Decision from the call: we'd prefer a special syntax for the stdlib imports:
|
Also, instead of Just for the record, some things we considered on the call:
|
This was recently mentioned in the EthOnline Future of Solidity talk, but we have been discussing this here and there for the past months, and goes back as early as #228.
The goal is to move functionality out of the compiler into code written in Solidity and slowly build out a standard library -- lets call it
stdlib
. Files/contracts/functions from thestdlib
would need to be explicitly imported, and would not be exposed implicitly. Initially this file would still be part of the compiler source code and included as a literal in the binary, but potentially in the future it could live outside should importing from content addressible locations turn more naturally supported by tools.Functionality we want to move out / include:
address
)block
,tx
, andmsg
There is some initial work available in https://github.com/ethereum/solidity/tree/stdlib
The text was updated successfully, but these errors were encountered: