"Matlab-like" plotting library

Issue 1130: The parse* functions are either undocumented or public instead of private.

Reported by Michael Baudin, Mar 28, 2013

See for example :

http://forge.scilab.org/index.php/p/plotlib/source/tree/HEAD/trunk/pl
otlib/macros/parseData.sci

If the function is meant to be used, it should be documented. If 
not, it should be private (i.e. internal).

Comment 1 by Stéphane Mottelet, Mar 29, 2013

How do you make function private/internal ?

Comment 2 by Michael Baudin, Apr 18, 2013

Look, for example, at the "double-double" module :

http://forge.scilab.org/index.php/p/dbldbl/source/tree/HEAD/macros

In the dbldbl_new function :

http://forge.scilab.org/index.php/p/dbldbl/source/tree/HEAD/macros/db
ldbl_new.sci

the statement :

dbldblinternallib=lib(fullfile(path,"macros","internal
s"))

loads the library located in the macros/internals directory. We use 
the "lib" function manually in order to load the functions 
defined in the given directory. This way, the functions loaded 
within the dbldbl_new function are only available to the dbldbl_new 
function, and not outside. 
In order to build the macros/internals functions, we just modified 
the buildmacros.sce script :

http://forge.scilab.org/index.php/p/dbldbl/source/tree/HEAD/macros/bu
ildmacros.sce

which executes the macros/internals/buildmacros.sce script:

exec(fullfile(path,"internals","buildmacros.sce")
)

Comment 3 by Michael Baudin, Apr 18, 2013

The advantages of this method is that is simple, does not require 
more than a few extra lines of codes and can "hide" an 
unlimited number of functions.

A potential drawback of this method is that everywhere we use an 
private ("internal") function, then we have to use the 
"lib" statement, which might be cumbersome if the private 
function is used many times. This also has a potential performance 
impact.

I think that it would make a great entry into "Programming in 
Scilab"...

Created: 4 years 8 months ago by Michael Baudin

Updated: 4 years 7 months ago

Status: New

Followed by: 1 person

Labels:
Priority:Medium
Type:Defect