Oddity with Triggers

General APL language issues
Post Reply
petermsiegel
Posts: 159
Joined: Thu Nov 11, 2010 11:04 pm

Oddity with Triggers

Post by petermsiegel »

What is going on here (or what am I missing)?

Code: Select all

)clear
clear ws
 ∇ foo args             
[1]  [1]    :Implements Trigger *               
[2]  [2]    (⍕⎕THIS),'.',args.Name,' has changed'
[3]  [3]    :If 2=args.⎕NC'Indexers'             
[4]  [4]        '≢Indexers',(≢args.Indexers)     
[5]  [5]        'Indexers',,args.Indexers       
[6]  [6]    :EndIf                               
[7]       ∇     
            ⎕FX ⎕CR 'foo'
           
      a←2 3 3⍴0
#.a has changed
       a[1;2;2]←0
#.a has changed
≢Indexers 1
Indexers 5E¯324
       a[1;⍳2;⍳2]←5
#.a has changed
≢Indexers 4
Indexers 9 10 12 5E¯324 ¯3.59538627E308 5E¯324 2.84E¯321 1E¯323


In version:
Interpreter:
Version: 17.0.36073
Platform: Mac-64
Edition: Unicode/64
Date: Mar 29 2019 at 09:33:41


THANKS!
User avatar
AndyS|Dyalog
Posts: 263
Joined: Tue May 12, 2009 6:06 pm

Re: Oddity with Triggers

Post by AndyS|Dyalog »

Hi Peter

Dyalog's fault this one ! I mentioned this in my presentation at Dyalog '17 but have only just remembered that I said:

"Triggers are tricky things. One gotcha is that they do not work if created or edited with the line editor - if in doubt, ⎕FX ⎕VR Trigger (not ⎕OR). Note that ∇foo∇ does not use the line editor so you can view the function without disabling the trigger."

I suspect that, quite reasonably, you copied and pasted the example from the documentation .. and since the pasting involved using the line editor, the trigger fails. Simply refixing the function should sort things out.

There is already an open issue about this; I will talk to the developers and depending on the timescales of any likely fix I may update the documentation to reflect this limitation.
petermsiegel
Posts: 159
Joined: Thu Nov 11, 2010 11:04 pm

Re: Oddity with Triggers

Post by petermsiegel »

Thanks. (My actual problem was more complicated, but I just wanted to simplify).

Breaking news:
1) I saved the function to a name: n←⎕VR 'foo' and erased the original 'foo' so there shouldn't be any residual breakage(?).
2) Then I refixed it via ⎕FX.

The same error was still there-- i.e. the indexer consistently returns garbage at least when changing exactly one item, e.g. a[5]. The original variable (the one changed) has the correct value, but the INDEX reported by the indexer is useless. So, AFAIK, there still is a showstopper at least on this Mac. [I am a recipient of a free license, so just happy to report bugs / anomalies. I have a workaround!).

Could I ask?... Is there a list of reported bugs anywhere. I come across anomalies from time to time, but wouldn't mind at all first checking if they're on a list. (Some I reported way back when, but don't know if they're fixed). I realize that's a Python culture, but it's a good way to get the community to check stuff out systematically and/or quietly adopt workarounds for issues that may be getting fixed soon.

Cheers.
User avatar
AndyS|Dyalog
Posts: 263
Joined: Tue May 12, 2009 6:06 pm

Re: Oddity with Triggers

Post by AndyS|Dyalog »

Hi Peter

Sorry .. I missed the second part of your question. Indeed those values are simply wrong. I have logged an issue about this and will get the developers to investigate.

Currently the list of fixed and outstanding bugs is visible only to those who have a DSS contract - but that may change at some point.

You're always welcome to drop support@dyalog.com a note when you find a problem .. and a bug is a bug, no matter who finds it. Once we've developed a fix for this we'll get you an updated interpreter.


Regards
Andy
Post Reply