You could put all declarations of your constants in one script and place them in a locale.
Everywhere else in your application you would then only use them. You might name that locale consts to make it clear. 2010/1/24 Ian Clark <[email protected]>: > 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 > -- Björn Helgason, Verkfræðingur Fornustekkum II 781 Hornafirði Po Box 127,801 Selfoss , t-póst: [email protected] gsm: +3546985532 sími: +3544781286 http://groups.google.com/group/J-Programming Tæknikunnátta höndlar hið flókna, sköpunargáfa er meistari einfaldleikans góður kennari getur stigið á tær án þess að glansinn fari af skónum /|_ .-----------------------------------. ,' .\ / | Með léttri lund verður | ,--' _,' | Dagurinn í dag | / / | Enn betri en gærdagurinn | ( -. | `-----------------------------------' | ) | (\_ _/) (`-. '--.) (='.'=) ♖♘♗♕♔♙ `. )----' (")_(") ☃☠ ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
