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

Home > Relatively Quick and Simple Way to Convert from Old Dot Scoping to New Parentheses Scoping?

Question
Dominic Chui · Oct 11, 2021

Relatively Quick and Simple Way to Convert from Old Dot Scoping to New Parentheses Scoping?

Does anyone know of a relatively quick and straightforward way of converting code written in the old dot scoping syntax with argumentless do (see here for reference: https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=RCOS_cdo_legacy) to the modern parentheses scoping syntax? It's not too bad to do it by hand, but it's also easy to make a mistake and leave a "quit" in an if statement by accident for example.

E.g.

do:someCondition

.set value = do ##class(ExampleClass).ExampleFunctionThatReturnsValue()  quit:'value

.do ##class(ExampleClass).ExampleOtherFunction()

Should probably become

if someCondition {

    set value = do ##class(ExampleClass).ExamplesFunctionThatReturnsValue()    

    if value {

            do ##class(ExampleClass).ExampleOtherFunction()

    }

}

where the quit is removed to avoid premature exiting of the larger code block.

#Caché #InterSystems IRIS

Source URL:https://community.intersystems.com/post/relatively-quick-and-simple-way-convert-old-dot-scoping-new-parentheses-scoping