"Correction to Index Generator"
Posted: Sat Nov 12, 2011 7:33 am
The release notes of version 13.0 innocently note that the index generator has been corrected. In the past (prior 13.0) this happened:
⍳⍬
1
This is considered incorrect. In version 13.0 it changed:
⍳⍬
]display ⍳⍬
┌─────┐
│ ┌⊖┐ │
│ │0│ │
│ └~┘ │
└∊────┘
(⊂⍬)≡⍳⍬
1
So what?!
Well, the impact is dramatic! For example, the idiom {⍵/⍳⍴⍵} stops working correctly on scalars:
{⍵/⍳⍴⍵}1 ⍝ 12.1
1
{⍵/⍳⍴⍵}1 ⍝ 13.0
Those who believe the DRY principle ("Don't repeat yourself") is a good thing will change their "Where" utility and that's it (well, not quite), but in code that has grown over decades one is likely to have plenty of lines of code which implement this idiom in one way or another. They all need to be changed.
Note that the code only stops working when a scalar homes in. Therefore it may take quite a while until the problem makes an appearance. If the code immediately breaks consider yourself lucky since otherwise the program may carry on and break far away later, or not at all but produce wrong results.
And this is just the tip of the iceberg: of course it's not only the idiom that has become jeopardized: any statement with an ⍳ may suffer from this.
I am questioning whether it was a good idea to change this at all. There are no plusses as far as I am concerned. The drawbacks are apparent: any application needs to be checked carefully.
Another problem is that this got changed in 13.0 but not in prior versions. Why is that? Is it a good idea to establish incompatibilities between different versions? I doubt that, too. For example, I am currently dealing with 4 different versions of Dyalog on an almost daily basis; such differences make life not exactly easier.
⍳⍬
1
This is considered incorrect. In version 13.0 it changed:
⍳⍬
]display ⍳⍬
┌─────┐
│ ┌⊖┐ │
│ │0│ │
│ └~┘ │
└∊────┘
(⊂⍬)≡⍳⍬
1
So what?!
Well, the impact is dramatic! For example, the idiom {⍵/⍳⍴⍵} stops working correctly on scalars:
{⍵/⍳⍴⍵}1 ⍝ 12.1
1
{⍵/⍳⍴⍵}1 ⍝ 13.0
Those who believe the DRY principle ("Don't repeat yourself") is a good thing will change their "Where" utility and that's it (well, not quite), but in code that has grown over decades one is likely to have plenty of lines of code which implement this idiom in one way or another. They all need to be changed.
Note that the code only stops working when a scalar homes in. Therefore it may take quite a while until the problem makes an appearance. If the code immediately breaks consider yourself lucky since otherwise the program may carry on and break far away later, or not at all but produce wrong results.
And this is just the tip of the iceberg: of course it's not only the idiom that has become jeopardized: any statement with an ⍳ may suffer from this.
I am questioning whether it was a good idea to change this at all. There are no plusses as far as I am concerned. The drawbacks are apparent: any application needs to be checked carefully.
Another problem is that this got changed in 13.0 but not in prior versions. Why is that? Is it a good idea to establish incompatibilities between different versions? I doubt that, too. For example, I am currently dealing with 4 different versions of Dyalog on an almost daily basis; such differences make life not exactly easier.