Re: Comments on the .m file editor
- To: mathgroup at smc.vnet.net
- Subject: [mg87999] Re: Comments on the .m file editor
- From: David Bailey <dave at Remove_Thisdbailey.co.uk>
- Date: Mon, 21 Apr 2008 14:37:48 -0400 (EDT)
- References: <fu9fss$cdu$1@smc.vnet.net> <fuc828$a56$1@smc.vnet.net>
David Park wrote: > I don't see the advantages of writing package with the .m file editor. > Normally I don't even look at the .m file. I would be interested in hearing > comments from some of the sophisticated users about when writing .m files > directly might be advantagous. > > Normally a routine should be written and debugged in a regular Mathematica > ..nb notebook. A debugging method that works for almost all cases and is very > easy to use is just to insert temporary Print statements into the routine. > > When a routine is debugged, and a usage message and SyntaxInformation are > written it can just be moved to a package.nb notebook with Initialization > cells that has been saved as an Auto Generated Package. > > That is by far the easiest method. > > You can put (* comments *) anywhere in a Mathematica expression but one very > negative feature of Mathematica is that if one uses Shift-Ctrl-N or > Shift-Ctrl-I to convert and reformat a cell it strips out all the comments. > I think comments should be considered a permanent part of an expression and > never stripped out by such reformating. > I find there are lots of advantages to having computer code in a simple text file. It makes it easy to use utilities like grep and file comparators, or to create your own utilities - such as a code indenter that works to your personal whim! The ability to skip to a particular function or section is also convenient. The time I must have wasted debugging AutoGenetated Page's in which one cell was accidentally not marked as Initialisation - editing one file is so much nicer. David Bailey http://www.dbaileyconsultancy.co.uk