From maintainers-request at octave dot org Sun Nov 13 09:03:30 2005 Subject: usage statement on builtin functions From: Paul Kienzle To: William Poetra Yoga H Cc: octave maintainers mailing list Date: Sun, 13 Nov 2005 10:02:30 -0500 On Nov 13, 2005, at 7:56 AM, William Poetra Yoga H wrote: > --- Paul Kienzle wrote: > >> >> On Nov 12, 2005, at 11:34 PM, William Poetra Yoga H wrote: >> >>> Btw, is my usage of at sc{} appropriate? >>> Also, can I replace usage(...) above with this? >>> >>> help("isunix"); >>> error(""); >> >> No. This forces output to the terminal even if you are in >> an environment such as try ... catch or eval(code,catch). >> > > Well then, I think it would be nice if we can make function files > behave like > built-in functions: if it takes an argument and we don't specify one, > it would > print the help message and exit with an error. Maybe we should have a > specialized function to do this? I agree that builtin functions should behave like scripts. However I prefer the script behaviour of printing a one-line usage statement when functions are used incorrectly rather than dumping a screenful of docs. Making this change to Octave would require substantial effort, so I wouldn't start it before asking John if he agrees. The implementation should also consider a possible future IDE. An IDE should be able to introspect on the function when providing feedback to the user on what parameters it is expecting. The usage statement is a simplified version of this. - Paul