Recent posts:
Julius has not published any posts yet.
Recent replies:

The question was (see the original post),  why does a command work in a terminal but not in a method. And, as you know, the answer lies in the scoping. I would say, he (@David Hockenbroch) tries to learn and understand the nature of indirection and is not working on a production grade problem.

But maybe I'm wrong... who knows.

He (@David Hockenbroch) is playing with inderection, using $classmethod() instead of ##class(classname).methodname(...)  does not solve the scoping problem:

ClassMethod testvalidator(class As %String, value As %String) As %Status
  set validator = "sc = $classmethod(class, ""IsValid"", value)"
   write validator,!
   set @validator
   write sc,!
   quit sc

The above method gives you the same <UNDEF> error because of non global scoping! By using indirection both variables (validator and sc) must have global scope.

As @Sergei.Shutov pointed out, you can switch off the procdere block by a keyword for the whole class. Additionaly, you can switch on or off the procedure block keyword for a particular  method too. In your case:

class Some.Class  Extends %RegisteredObject
/// a procedure block method
ClassMethod ProcBlock()

/// a nonprocedurblock method
ClassMethod NoProcBlock() [ ProcedureBlock = 0 ]
// Caution: All variables have a global scope, hence, they will overwrite variables with the same name, which were created previously. To avoid this, use the NEW command, to protect them (if desired).

Julius has not followed anybody yet.
Global Masters badges: