I know that "Consistency is the hobgoblin of small minds" so this is not a burning issue, but a point of mild curiosity in the interest of writing parsimonious code.
In our work, we write a lot of .ado files and we often use the display command to send informative messages to the screen / log.
When we want the message to appear in a red font, we use 'display as error'. And for black we often (lazily) use the display command without specifying a style. This works as expected in interactive mode, as demonstrated in Example 1 in the screenshot below.
But sometimes inside loops & programs the 'as error' style seems to carry over or persist from one display command to another when we did not intend that. See Example 2 in the screenshot below.
The problem is easily addressed: Always specify the style explicitly...as shown in Example 3 below. But I am curious whether the persistence of the error style is intentional and curious about how I can identify situations where I can confidently get away with typing di without specifying the style. I would naively and lazily prefer each new simple 'di' command to be a synonym for 'di as text'. But I cannot count on that working everywhere.
Again...not a burning issue, but if there's a clear explanation, I'd love to be enlightened.
Thank you,
-Dale
In our work, we write a lot of .ado files and we often use the display command to send informative messages to the screen / log.
When we want the message to appear in a red font, we use 'display as error'. And for black we often (lazily) use the display command without specifying a style. This works as expected in interactive mode, as demonstrated in Example 1 in the screenshot below.
But sometimes inside loops & programs the 'as error' style seems to carry over or persist from one display command to another when we did not intend that. See Example 2 in the screenshot below.
The problem is easily addressed: Always specify the style explicitly...as shown in Example 3 below. But I am curious whether the persistence of the error style is intentional and curious about how I can identify situations where I can confidently get away with typing di without specifying the style. I would naively and lazily prefer each new simple 'di' command to be a synonym for 'di as text'. But I cannot count on that working everywhere.
Again...not a burning issue, but if there's a clear explanation, I'd love to be enlightened.
Thank you,
-Dale
Comment