aboutsummaryrefslogtreecommitdiffstats
path: root/docs/layout-of-source-files.rst
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2016-08-20 01:57:21 +0800
committerchriseth <c@ethdev.com>2016-09-01 06:02:51 +0800
commit3c412ed2f63a58b27eeb00fe584b9378311b099f (patch)
treecba706f91c05658a8b1f8794ad21745ea5619e39 /docs/layout-of-source-files.rst
parent52d9f897126394dcc7388277d4fbd3ef7b4df38a (diff)
downloaddexon-solidity-3c412ed2f63a58b27eeb00fe584b9378311b099f.tar
dexon-solidity-3c412ed2f63a58b27eeb00fe584b9378311b099f.tar.gz
dexon-solidity-3c412ed2f63a58b27eeb00fe584b9378311b099f.tar.bz2
dexon-solidity-3c412ed2f63a58b27eeb00fe584b9378311b099f.tar.lz
dexon-solidity-3c412ed2f63a58b27eeb00fe584b9378311b099f.tar.xz
dexon-solidity-3c412ed2f63a58b27eeb00fe584b9378311b099f.tar.zst
dexon-solidity-3c412ed2f63a58b27eeb00fe584b9378311b099f.zip
Version pragma.
Diffstat (limited to 'docs/layout-of-source-files.rst')
-rw-r--r--docs/layout-of-source-files.rst31
1 files changed, 30 insertions, 1 deletions
diff --git a/docs/layout-of-source-files.rst b/docs/layout-of-source-files.rst
index 6ef06961..3697fdfb 100644
--- a/docs/layout-of-source-files.rst
+++ b/docs/layout-of-source-files.rst
@@ -2,7 +2,36 @@
Layout of a Solidity Source File
********************************
-Source files can contain an arbitrary number of contract definitions and include directives.
+Source files can contain an arbitrary number of contract definitions, include directives
+and pragma directives.
+
+.. index:: ! pragma, version
+
+Version Pragma
+==============
+
+Source files can (and should) be annotated with a so-called version pragma to reject
+being compiled with future compiler versions that might introduce incompatible
+changes. We try to keep such changes at an absolute minimum and especially
+introduce changes in a way that changes in semantics will also require changes
+in the syntax, but this is of course not always possible. Because of that, it is always
+a good idea to read through the changelog at least for releases that contain
+breaking changes, those releases will always have versions of the form
+``0.x.0`` or ``x.0.0``.
+
+The version pragma is used as follows::
+
+ pragma solidity ^0.4.0;
+
+Such a source file will not compile with a compiler earlier than version 0.4.0
+and it will also not work on a compiler starting form version 0.5.0 (this
+second condition is added by using ``^``). The idea behind this is that
+there will be no breaking changes until version ``0.5.0``, so we can always
+be sure that our code will compile the way we intended it to. We do not fix
+the exact version of the compiler, so that bugfix releases are still possible.
+
+It is possible to specify much more complex rules for the compiler version,
+the expression follows those used by npm.
.. index:: source file, ! import