Skip to content

Commit

Permalink
A few small adjustments in the manual
Browse files Browse the repository at this point in the history
  • Loading branch information
waldyrious committed May 13, 2013
1 parent 1cea137 commit a270615
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
3 changes: 2 additions & 1 deletion doc/manual/types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,8 @@ instance of such types::
true

The ``is`` function confirms that the "two" constructed instances of
``NoFields`` are actually one and the same.
``NoFields`` are actually one and the same. Singleton types are
described in further detail `below <#man-singleton-types>`_.

There is much more to say about how instances of composite types are
created, but that discussion depends on both `Parametric
Expand Down
22 changes: 11 additions & 11 deletions doc/manual/variables-and-scoping.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ rules; this section spells them out in detail.
Certain constructs in the language introduce *scope blocks*, which are
regions of code that are eligible to be the scope of some set of
variables. The scope of a variable cannot be an arbitrary set of source
lines, but will always line up with one of these blocks. The constructs
introducing such blocks are:
lines; instead, it will always line up with one of these blocks.
The constructs introducing such blocks are:

- ``function`` bodies (:ref:`either syntax <man-functions>`)
- ``while`` loops
Expand All @@ -44,7 +44,7 @@ current scope are as follows:
function's body scope.
- An assignment ``x = y`` introduces a new local variable ``x`` only if
``x`` is neither declared global nor explicitly introduced as local
by any enclosing scope, before or *after* the current line of code.
by any enclosing scope before *or after* the current line of code.

In the following example, there is only one ``x`` assigned both inside
and outside the ``for`` loop::
Expand Down Expand Up @@ -113,14 +113,14 @@ not come before an inner usage::
julia> foo(10)
13

This last example may seem slightly odd for a normal variable, but
allows for named functions — which are just normal variables holding
function objects — to be used before they are defined. This allows
functions to be defined in whatever order is intuitive and convenient,
rather than forcing bottom up ordering or requiring forward
declarations, both of which one typically sees in C programs. As an
example, here is an inefficient, mutually recursive way to test if
positive integers are even or odd::
This behavior may seem slightly odd for a normal variable, but allows
for named functions — which are just normal variables holding function
objects — to be used before they are defined. This allows functions to
be defined in whatever order is intuitive and convenient, rather than
forcing bottom up ordering or requiring forward declarations, both of
which one typically sees in C programs. As an example, here is an
inefficient, mutually recursive way to test if positive integers are
even or odd::

even(n) = n == 0 ? true : odd(n-1)
odd(n) = n == 0 ? false : even(n-1)
Expand Down

0 comments on commit a270615

Please sign in to comment.