From: Michael C. <Mic...@ua...> - 2006-03-22 13:23:05
|
Bill Denney wrote: > On Wed, 22 Mar 2006, Michael Creel wrote: > >> Hello all, >> I'm planning on converting the existing bfgsmin (source bfgsmin.cc) to >> a new function __bfgsmin (source __bfgsmin.cc), and writing a user >> frontend bfgsmin.m. A couple of questions > > > What is the benefit of doing this? Simplicity and code re-use: All the C functions would have their arguments checked in the same place. As it is, there's more scope for programmer error since there are multiple copies of essentially the same argument checks. Extendability: Someone writing a different frontend to __bfgsmin (for example, a general minimization routine that allows the method to be user selected) would have intelligible Octave expressions for argument checks to use as an example, rather than the less user friendly C argument checks. > >> 1) All input checking will be in the .m file frontend. Thus, it will >> be possible to crash octave by directly calling __bfgsmin with bad >> arguments. Is that acceptable? > > > My personal opinion is that every function should do full error checking > of its arguements. I know that people are writing web front-ends to > octave, and that could lead to dangerous code. > > The way that I view this is that some day, someone will call __bfgsmin > and get an error and complain about it. Then we'll have to add the > arguement checking anyway, so it should just be added from the beginning. Well, that's the way it is now, so if this is not a well-received idea, the course of action is clear :-) Thanks for the input. M. |