Param() Oddity

Arthur Urban aturban at qwest.net
Fri Sep 10 01:08:57 EDT 2004


> > I'm trying to use the param() function, but it is behaving "badly". 
> > Here is the meat of the issue. Consider this fragment, param(1) = 
> > 'card "CardName" verified in variable watcher':
> > 
> >   put fld "F" of param(1) is empty into x
> > 
> > The above code blows up stating that fld "F" cannot be 
> found. However, 
> > if I add a line as follows:
> > 
> >   put param(1) into tCard
> >   put fld "F" of tCard is empty into x
> > 
> > This works!(?) Why can't I just use param(1)? The "documentation" 
> > implies that I've used it correctly.
> 
> The parameter will be interpreted as a text string, and the 
> engine will 
> see it like this:
> 
>    put fld "F" of "card 'CardName'" is empty into x
> 
> This doesn't compile. By putting it into a variable first, 
> you've forced 
> the engine to evaluate it. You can also do evalution using the "do" 
> command like this:
> 
> do "put fld" && quote & "F" & quote && "of" && param(1) && 
> "is empty into x"
> 
> but that is not only hard to read, it requires that the 
> script load the 
> compiler every time that line runs. Your second way is cleaner.

Thank you for that helpful explanation. At least I "get it" now. So as long
as I'm just passing strings and numbers, I'm okay. Appears as if the
Transcript could use and 'object' type-cast command ala value.

  go object( param(1) )
  
  get the myProperty of object( param(1) )

Why is Revolution complicated in areas it should be elegant?

~~~ Arthur

"Never interrupt your enemy while he is making a mistake."




More information about the use-livecode mailing list