Dominic Chui · Oct 11

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: 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.



.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.

1 0 2 106
Log in or sign up to continue

If this change is to be made in a multitude of classes, I advise writing a computer program that will perform this task.
But is it necessary to do it?

Considering the complexity of the task of parsing, I'm not sure it makes too much sense to write one from scratch. I was hoping to see if someone else had already done the work or tried it in the past.

In terms of is it necessary, not strictly no, but the modern parentheses syntax is much easier to read, maintain and modify.