IMO executing a raft of asserts at frequent intervals to check that every constant you use still has its original value is a last-ditch measure to trace a troublesome bug, not a routine precaution.
On reflection I think I'd prefer to proliferate "constant functions", like empty_z_. Or, recalling that the consts I felt I needed when writing C++ were invariably for use in logical tests, I ought to try and re-cast my consts as Boolean verbs, so: if. replyYES -: reply do. if. YESequals reply do. Ian 2010/1/23 Björn Helgason <[email protected]>: > One way of making sure you have a certain value is to use assert. > > 2010/1/22 Ian Clark <[email protected]>: >> Another thing I'd really like in J (and rookies shouldn't be allowed >> to ask such things) is something like the C++ "const". A way of >> locking down the name of a quantity so that it can't be changed during >> "the run", whatever that is -- at least not without raising an error. >> Or (like []WATCHPOINTS in APL+Win) firing an event -- but that has >> other smart possibilities. > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
