Re: type checking ?
- Posted by Pete Lomax <petelomax at b?ueyon?er.co.uk> Nov 23, 2007
- 632 views
Bernie Ryan wrote: > Derek Parnell wrote: > > A user of Bernie's application must supply a couple of include files. > > > > global constant WhatEver = "some text" > > Thanks for explaining it. > That is exactly what I mean. > How can you be sure that a user enters the token WhatEver which > represents a string constant and not the string "WhatEver" Is the missing bit the way that constant is defined? What if you did something similar to this:
global constant Whatever = fixedText("some text")
where fixedText just appended to allFixedText and returned the index, then useit could be:
procedure useit(object txt) if atom(txt) then txt = allFixedText[txt] else if find(txt,allFixedText) then ?9/0 end if end if end procedure
A smarter solution would be that useit always expects an integer idx param. Regards, Pete