Mercurial > octave
changeset 23854:aa0c6708046a
import.m: Add placeholder m-file for import functionality.
* NEWS: Announce that bareword "import" is recognized, but funcionality is
not yet implemented.
* scripts/path/import.m: New function. Has documentation and BIST test, but
merely emits an error if used.
* scripts/path/module.mk: Add import.m to build system.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 09 Aug 2017 11:31:10 -0700 |
parents | f8660521678e |
children | f9498eb0bbc1 |
files | NEWS scripts/path/import.m scripts/path/module.mk |
diffstat | 3 files changed, 65 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/NEWS Wed Aug 09 10:25:06 2017 -0700 +++ b/NEWS Wed Aug 09 11:31:10 2017 -0700 @@ -19,6 +19,11 @@ storing and retrieving values by name, rather than by position which is how arrays work. + ** The bareword "import" is now recognized in scripts and functions. + However, the functionality to import functions and classes from + other namespaces into the local scope has not yet been implemented. + Attempting to use "import" will provoke an error message. + ** hex2num and num2hex now work for integer and char types and num2hex may optionally return a cell array of strings instead of a character array. If given a cell array of strings, hex2num now returns a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/path/import.m Wed Aug 09 11:31:10 2017 -0700 @@ -0,0 +1,59 @@ +## Copyright (C) 2017 Rik Wehbring +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 3 of the License, or +## (at your option) any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, see +## <http://www.gnu.org/licenses/>. + +## -*- texinfo -*- +## @deftypefn {} {} import PACKAGE.FUNCTION +## @deftypefn {} {} import PACKAGE.CLASS +## @deftypefn {} {} import PACKAGE.* +## @deftypefn {} {} import +## @deftypefn {} {@var{list} =} import +## +## Import function or classes into the current scope. +## +## @strong{Warning:} This functionality is not yet implemented, and invoking +## the function will emit an error. +## +## When invoked with the name of a PACKAGE and a FUNCTION or CLASS name, that +## name is made available in the current code without having to use namespace +## qualifiers. This can facilitate the readability of the code, and require +## less typing by programmers. +## +## Example +## +## @example +## import containers.Map; +## +## m = Map ({"A", "B"}, {[1], [2]}); +## @end example +## +## When called with no inputs and no outputs @code{import} prints a list of +## any import definitions. +## +## When called with no inputs and one output, a cell array of strings +## @var{list} is returned with any import definitions. +## +## @end deftypefn + +function list = import (varargin) + + error ("the import function is not yet implemented in Octave"); + +endfunction + + +%!error <not yet implemented> import ("foobar");