Published on InterSystems Developer Community (https://community.intersystems.com)

Home > Indirection Different In Terminal Than In Method

Question
David Hockenbroch · Oct 14, 2021

Indirection Different In Terminal Than In Method

If I open a terminal and type the following commands, sc is an error:

set validator = "sc = ##class(%Library.Numeric).IsValid(""BLAH"")"
set @validator
write sc

At the end, when I write sc I get:

0 L'BLAH9
             DOCXT010,#e^zIsValid+1^%Library.Numeric.1^1e^^^1

However, if I call the following class method using the arguments "%Library.Numeric" and "BLAH", sc is undefined

 ClassMethod testvalidator(class As %String, value As %String) As %Status
{
set validator = "sc = ##class("_class_").IsValid("""_value_""")"
write validator,!
set @validator
write sc,!
quit sc
}

When it tries to write sc, I get:

write sc,!
 ^
<UNDEFINED>zvalidator+4^DXT4.tagvalue.1 *sc

And I can't figure out what's making that different. Why would this behave differently in this method than doing the same thing line by line in the terminal?

#Debugging #ObjectScript #Terminal #Caché
Product version: Caché 2018.1
$ZV: Cache for UNIX (Red Hat Enterprise Linux for x86-64) 2018.1.2 (Build 309U) Mon Mar 4 2019 15:07:46 EST

Source URL:https://community.intersystems.com/post/indirection-different-terminal-method