Skip to content

Commit

Permalink
Big overhaul of "Scope" manual section
Browse files Browse the repository at this point in the history
(cherry picked from commit 41911d9)
ref JuliaLang#12146
  • Loading branch information
mauro3 authored and tkelman committed Mar 7, 2016
1 parent 910baf8 commit 64da48a
Show file tree
Hide file tree
Showing 4 changed files with 309 additions and 185 deletions.
1 change: 1 addition & 0 deletions doc/manual/functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,7 @@ tuple, explicitly after a semicolon. For example, ``plot(x, y;
``plot(x, y, width=2)``. This is useful in situations where the
keyword name is computed at runtime.

.. _man-evaluation-scope-default-values:

Evaluation Scope of Default Values
----------------------------------
Expand Down
14 changes: 8 additions & 6 deletions doc/manual/modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@

.. index:: module, baremodule, using, import, export, importall

Modules in Julia are separate global variable workspaces. They are
delimited syntactically, inside ``module Name ... end``. Modules allow
you to create top-level definitions without worrying about name conflicts
when your code is used together with somebody else's. Within a module, you
can control which names from other modules are visible (via importing),
and specify which of your names are intended to be public (via exporting).
Modules in Julia are separate variable workspaces, i.e. they introduce
a new global scope. They are delimited syntactically, inside ``module
Name ... end``. Modules allow you to create top-level definitions (aka
global variables) without worrying about name conflicts when your code
is used together with somebody else's. Within a module, you can
control which names from other modules are visible (via importing),
and specify which of your names are intended to be public (via
exporting).

The following example demonstrates the major features of modules. It is
not meant to be run, but is shown for illustrative purposes::
Expand Down
2 changes: 2 additions & 0 deletions doc/manual/noteworthy-differences.rst
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ some noteworthy differences that may trip up Julia users accustomed to MATLAB:
``ans`` is not set when Julia code is run in non-interactive mode.
- Julia's ``type``\ s do not support dynamically adding fields at runtime,
unlike MATLAB's ``class``\ es. Instead, use a :obj:`Dict`.
- In Julia each module has its own global scope/namespace, whereas in
Matlab there is just one global scope.

Noteworthy differences from R
-----------------------------
Expand Down
Loading

0 comments on commit 64da48a

Please sign in to comment.