Question
· Mar 17, 2021

Has a class been compiled?

Is there an easy way to see if a class object has been compiled or needs to be?  Or to get a list of classes that need to be compile in a particular namespace?

Product version: IRIS 2020.1
Discussion (4)1
Log in or sign up to continue

In SMP / Explorer you can get
class by name and its last date 
under routines
      the object by related name  

- - - -- - - -

In addition in Studio, a class that is saved but not compiled
is marked with + after the name 

while a changed class that is neither saved nor compiled
is marked by * 

I have no idea if VSCode or Atelier have similar features.

$system.OBJ.IsUpToDate()might fit the bill for your first question.

set sc = $system.OBJ.GetClassList(.classes)
set cls="", outdated=""
for {
    set cls = $order(classes(cls))
    quit:(cls="")
    if '$system.OBJ.IsUpToDate(cls) set outdated = outdated _ $lb(cls)
}
for i=1:1:$listlength(outdated) {
    write $listget(outdated, i)
}

should work for your 2nd question (documentation here: https://docs.intersystems.com/irislatest/csp/documatic/%25CSP.Documatic....)

using SQL you can compare the last change between definition and compilation of classes
a negative difference shows where recompilation is required.
I used Posix-Timeformat for an easier compare

SELECT 
def.ID, cmp.TimeChanged compiled,  def.TimeChanged defined, 
to_char($piece(cmp.TimeChanged,',',1),'J')-to_char($piece(def.TimeChanged,',',1),'J') diff
FROM %Dictionary.ClassDefinition def
left outer join %Dictionary.CompiledClass cmp
on def.ID=cmp.ID
where NOT def.name %startswith '%'
order by 4