'from' statement documented

This commit is contained in:
Araq 2013-05-19 23:41:12 +02:00
commit a23d418d78
4 changed files with 33 additions and 4 deletions

View file

@ -4178,6 +4178,25 @@ module name followed by an ``except`` to prevent some symbols to be imported:
echo "$1" % "abc" echo "$1" % "abc"
From import statement
~~~~~~~~~~~~~~~~~~~~~
After the `from`:idx: statement a module name follows followed by
an ``import`` to list the symbols one likes to use without explict
full qualification:
.. code-block:: nimrod
from strutils import `%`
echo "$1" % "abc"
# always possible: full qualification:
echo strutils.replace("abc", "a", "z")
It's also possible to use ``from module import nil`` if one wants to import
the module but wants to enforce fully qualified access to every symbol
in ``module``.
Export statement Export statement
~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~

View file

@ -1,4 +1,4 @@
version 0.9.2 version 0.9.4
============= =============
- make 'bind' default for templates and introduce 'mixin'; - make 'bind' default for templates and introduce 'mixin';
@ -27,7 +27,7 @@ Bugs
- result = result shr 8 for the "system()" wrapper - result = result shr 8 for the "system()" wrapper
version 0.9.4 version 0.9.x
============= =============
- macros as type pragmas - macros as type pragmas

View file

@ -11,7 +11,8 @@ the logo) as well as the HTML and CSS code for his template, and Dominik Picheta
for integrating Philip's design with the ``nimweb`` utility. We're sure you will for integrating Philip's design with the ``nimweb`` utility. We're sure you will
agree that Philip's design is beautiful. agree that Philip's design is beautiful.
2013-XX-XX Version 0.9.2 released
2013-05-20 Version 0.9.2 released
================================= =================================
Version 0.9.2 has been released! Get it `here <download.html>`_. Version 0.9.2 has been released! Get it `here <download.html>`_.
@ -96,6 +97,9 @@ Language Additions
- Objects can be initialized via an *object constructor expression*. - Objects can be initialized via an *object constructor expression*.
- There is a new syntactic construct ``(;)`` unifying expressions and - There is a new syntactic construct ``(;)`` unifying expressions and
statements. statements.
- You can now use ``from module import nil`` if you want to import the module
but want to enforce fully qualified access to every symbol in ``module``.
Notes for the future Notes for the future
-------------------- --------------------
@ -106,6 +110,7 @@ Notes for the future
functions. All the high-level features of the current ``sockets`` module functions. All the high-level features of the current ``sockets`` module
will be moved to a ``network`` module. will be moved to a ``network`` module.
2012-09-23 Version 0.9.0 released 2012-09-23 Version 0.9.0 released
================================= =================================
@ -493,7 +498,7 @@ Changes affecting backwards compatibility
- The pointer dereference operation ``p^`` is deprecated and might become - The pointer dereference operation ``p^`` is deprecated and might become
``^p`` in later versions or be dropped entirely since it is rarely used. ``^p`` in later versions or be dropped entirely since it is rarely used.
Use the new notation ``p[]`` in the rare cases where you need to Use the new notation ``p[]`` in the rare cases where you need to
dereference a pointer explicitely. dereference a pointer explicitly.
- ``system.readFile`` does not return ``nil`` anymore but raises an ``EIO`` - ``system.readFile`` does not return ``nil`` anymore but raises an ``EIO``
exception instead. exception instead.
- Unsound co-/contravariance for procvars has been removed. - Unsound co-/contravariance for procvars has been removed.

View file

@ -1,3 +1,8 @@
<a class="news" href="news.html#Z2013-05-20-version-0-9-2-released">
<h3>May 20, 2013</h3>
<p>Nimrod version 0.9.2 has been released!</p>
</a>
<a class="news" href="news.html#Z2012-09-23-version-0-9-0-released"> <a class="news" href="news.html#Z2012-09-23-version-0-9-0-released">
<h3>Sep 23, 2012</h3> <h3>Sep 23, 2012</h3>
<p>Nimrod version 0.9.0 has been released!</p> <p>Nimrod version 0.9.0 has been released!</p>