Re: type checking ?
- Posted by Matt Lewis <matthewwalkerlewis at gm?i?.com> Nov 21, 2007
- 632 views
Bernie Ryan wrote: > > > Bernie Ryan wrote: > > > > > > Suppose you have a function/procedure and one of its > > > parameters is a sequence. > > > > > > How can you type check the parameter to be a CONSTANT SEQUENCE NAME. > }}} <eucode> > constant > MySEQ = {1,2,3,4,5,6,7,8,9} > > procedure useit(sequence seq_name) > -- do stuff. > end procedure > > -- The user can enter this which is WRONG > useit("MySEQ") > > -- Or the user can enter this is CORRECT > useit(MySEQ) > > -- NOTE they are both sequences so procedure will accept either. > > </eucode> {{{ Unfortunately, this hasn't cleared it up for me. I guess that I have a couple of responses. If the passed value is incorrect, then you can simply validate it using equal(). Also, if the only correct value is a specific constant, then why pass it as a parameter at all? That seems to be just increasing typing for no benefit. I suspect that there's something more to this that you haven't made clear yet. What is the effect of one being WRONG and the other CORRECT? What about (in the above example):
useit({1,2,3,4,5,6,7,8,9})
Matt