Skip to content

Commit

Permalink
Merge pull request #12146 from mauro3/m3/scope-doc
Browse files Browse the repository at this point in the history
RFC: overhaul of "Scope" manual section
  • Loading branch information
StefanKarpinski committed Feb 1, 2016
2 parents 7e7d743 + abdfc24 commit 336f3e8
Show file tree
Hide file tree
Showing 4 changed files with 348 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 @@ -504,6 +504,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 336f3e8

Please sign in to comment.