ordering arrays
instead of with getting next index in the end of loop
set ind=$order(array(""))
for {
quit:ind=""
/// some code here
set ind=$order(array(ind))
}
should be
set ind=""
for {
set ind=$order(array(ind))
quit:ind=""
/// some code here
}
IMHO, it's more like best practices, not code style guidelines.
Agreed with Sasha @adaptun here - it's more suitable to future "Best Practices" Wiki. Same as with #10
Both loops above are fine. I wouldn't recommend one more than the other. The first style gives you the ability to quit before entering the loop, but there are 2 $order functions. The second style only has one $order function, but you always enter the loop.
In any way you entering the loop, and in second style, you also can quit before $order, but I don't see any way why it should be needed. One main idea, is, in first variant, you can't use continue, because you should first get a next value by $order, and after that you code will be unreadable. And in "right" variant, you can go to next value in any place of your loop.
set ind=""
for {
set ind=$order(array(ind))
quit:ind=""
quit:ind="end"
continue:$get(array(ind,"skip"))
/// some code here
}
We can start filling BESTPRACTICES.md as well
@eduard93 we could start witth MD file, but I still believe that Wiki pages would be easier to maintain and navigate for this kind of content.
@tsafin GitHub project wiki eg. MDX2JSON wiki is just another repo with md files, so I see no point in maintaining two repos with text files instead of one.
Or instead of wiki possible to use Read the docs, one of examples here
Although their markup might be the same, but from usabiliy point of view Wiki is much more convenient to use (especially for well structured hierarchy). IMVHO
@daimor but Read the docs looks nice. But this is external dependency, which might eventually disappear.
P.S. If time permits we need to play with this tool though.