diff options
author | holgerd77 <Holger.Drewes@googlemail.com> | 2016-02-18 17:34:23 +0800 |
---|---|---|
committer | holgerd77 <Holger.Drewes@googlemail.com> | 2016-02-18 17:34:23 +0800 |
commit | 9904dc386d30b6b8a6facb43d403a03269979237 (patch) | |
tree | 41a82a1f93a1c9a910213fcd848dc3594d80ce60 /docs/layout-of-source-files.rst | |
parent | 18997bf83aae8159dfcaeb19a655fba3915c67b5 (diff) | |
download | dexon-solidity-9904dc386d30b6b8a6facb43d403a03269979237.tar.gz dexon-solidity-9904dc386d30b6b8a6facb43d403a03269979237.tar.zst dexon-solidity-9904dc386d30b6b8a6facb43d403a03269979237.zip |
Use code blocks for import syntax explanations for better readability
Diffstat (limited to 'docs/layout-of-source-files.rst')
-rw-r--r-- | docs/layout-of-source-files.rst | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/docs/layout-of-source-files.rst b/docs/layout-of-source-files.rst index b795d154..3fb64635 100644 --- a/docs/layout-of-source-files.rst +++ b/docs/layout-of-source-files.rst @@ -17,15 +17,33 @@ Solidity supports import statements that are very similar to those available in At a global level, you can use import statements of the following form: -`import "filename";` will import all global symbols from "filename" (and symbols imported there) into the current global scope (different than in ES6 but backwards-compatible for Solidity). +:: -`import * as symbolName from "filename";` creates a new global symbol `symbolName` whose members are all the global symbols from `"filename"`. + import "filename"; -`import {symbol1 as alias, symbol2} from "filename";` creates new global symbols `alias` and `symbol2` which reference `symbol1` and `symbal2` from `"filename"`, respectively. +...will import all global symbols from "filename" (and symbols imported there) into the +current global scope (different than in ES6 but backwards-compatible for Solidity). + +:: + + import * as symbolName from "filename"; + +...creates a new global symbol `symbolName` whose members are all the global symbols from `"filename"`. + +:: + + import {symbol1 as alias, symbol2} from "filename"; + +...creates new global symbols `alias` and `symbol2` which reference `symbol1` and `symbol2` +from `"filename"`, respectively. Another syntax is not part of ES6, but probably convenient: -`import "filename" as symbolName;` is equivalent to `import * as symbolName from "filename";`. +:: + + import "filename" as symbolName; + +...is equivalent to `import * as symbolName from "filename";`. Paths ----- |