jsoftware/jsource

dbsig ignores x argument when is called from obverse

Opened this issue · 2 comments

jip commented

Test script in ~temp/dbsig_bug.ijs:

f=: 3 : 0
  'custom error in f' 13!:8^:((0 e. ])`(12"_)) y
  'result of f'
)

g=: 3 : 0
  ' and g' ,~ f y
)

h=: (3 : 0) :. (3 : 0)
  ' and h^:_1' ,~ f y
)
  ' and h' ,~ f y
)

Demonstration:

   load '~temp/dbsig_bug.ijs'
   f 1
result of f
   f 0
|custom error in f: f
|   'custom error in f'    13!:8^:(((<(<,'3'),<(<(,'0');0),(<'e.'),<,']'),<(<,'"'),<(<(,'0');12),<(,'0');_))y
   g 1
result of f and g
   g 0
|custom error in f: f
|   'custom error in f'    13!:8^:(((<(<,'3'),<(<(,'0');0),(<'e.'),<,']'),<(<,'"'),<(<(,'0');12),<(,'0');_))y
   h 1
result of f and h
   h 0
|custom error in f: f
|   'custom error in f'    13!:8^:(((<(<,'3'),<(<(,'0');0),(<'e.'),<,']'),<(<,'"'),<(<(,'0');12),<(,'0');_))y
   h^:_1 (1)
result of f and h^:_1
   h^:_1 (0)
|assertion failure
|the result was expected to be all 1
|       h^:_1(0)

So, dbsig ignores x argument when is called from obverse, as the last assertion failure demonstrates.

Version strings:

   JVERSION
Engine: j9.6.0-beta5/j64/linux
Build: commercial/2024-04-11T16:59:56/clang-11-0-0/SLEEF=1
Library: 9.6.5
Platform: Linux 64
Installer: j9.6 install
InstallPath: /home/user/j9.6.0-beta5_j64
Contact: www.jsoftware.com
   JVERSION
Engine: j9.5.1/j64/linux
Build: commercial/2023-12-20T04:06:17/clang-11-0-0/SLEEF=1
Library: 9.5.5
Platform: Linux 64
Installer: j9.5 install
InstallPath: /home/user/j9.5.1_j64
Contact: www.jsoftware.com
`
jip commented

I guess no: f, g and h verbs in my demo are monads. When dbsig is called from monadic obverse, it ignores x argument supplied to dbsig. And it uses it when called from direct monadic invocation.

I've just found a simpler demo:

h=: (3 : 0) :. (3 : 0)
  'custom error in h^:_1' 13!:8^:((0 e. ])`(12"_)) y
  'result of h^:_1'
)
  'custom error in h' 13!:8^:((0 e. ])`(12"_)) y
  'result of h'
)

Demo:

   h 1
result of h
   h 0
|custom error in h: h
|   'custom error in h'    13!:8^:(((<(<,'3'),<(<(,'0');0),(<'e.'),<,']'),<(<,'"'),<(<(,'0');12),<(,'0');_))y
Press ENTER to inspect
   h^:_1 (1)
result of h^:_1
   h^:_1 (0)
|assertion failure
|the result was expected to be all 1
|       h^:_1(0)