[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Removing input validation from private/ leaf functions
From: |
Rik |
Subject: |
Removing input validation from private/ leaf functions |
Date: |
Tue, 09 Jul 2013 22:03:48 -0700 |
7/9/13
John,
It seems that a common Octave programming structure is to have a
user-facing function--which accepts inputs, validates them, provides a
place for a documentation string-- and a backend or leaf function called
from the first function which does the actual calculation. For the m-files
this is often accomplished by putting the leaf function in a private
directory so that it won't get called accidentally. Given that perfectly
acceptable state of affairs, is there any problem with removing the extra
input validation from functions in private/ directories? It seems like a
good idea since these internal functions are not open to uncontrolled
access unless somebody is changing directories into private dirs or
otherwise trying to get around the built-in protection.
As a representative sample you could take a look at isequal and isequaln
which both call __isequal__ underneath. I don't see why __isequal__ needs
to check nargin since there are only two callers in the entire m-file tree
and they are calling it correctly.
--Rik
- Removing input validation from private/ leaf functions,
Rik <=