In the permissions library (https://github.com/DataIntellectTech/TorQ/blob/master/code/handlers/permissions.q), there is some logic to handle projections. Specifically in the function .pm.pdict https://github.com/DataIntellectTech/TorQ/blob/master/code/handlers/permissions.q#L76-L87, there is this code:
/if projection first obtain a list of function and fixed parameters (fnfp)
104h=type value f; [fnfp:value value f; (value[fnfp 0][1])!fnfp[1],a];
The context here is that f is a function name as a symbol, and a are the arguments that the user is passing. Here, where f is pointing to a projection, the code needs to combine the fixed parameters with the user's arguments a.
However, the current implementation makes some assumptions
- There is only one fixed parameter (
fnfp[1])
- The fixed parameter is the first parameter (we prefix
a with fixed param)
That means that this breaks on any projection with either multiple fixed params and/or fixed params other than first param.
For example, if we define following function & corresponding projections:
f:{[a;b;c;d]}
g:f[1]
h:f[1;2]
i:f[;2;3]
j:f[;;;4]
Only g works correctly with .pm.pdict. The others either throw an error (h, i), or give the incorrect output (j):
q).pm.dict[`g;2 3 4] /works
| ::
a| 1
b| 2
c| 3
d| 4
q).pm.dict[`i;3 4] /error
'length
[2] /home/jmcmurray/a.q:9: .pm.dict:
/if projection first obtain a list of function and fixed parameters (fnfp)
104h=type value f; [fnfp:value value f; (value[fnfp 0][1])!fnfp[1],a];
^
/get paramaters and make a dictionary with the arguments
q))\
q).pm.dict[`j;1 4] /error
'length
[2] /home/jmcmurray/a.q:9: .pm.dict:
/if projection first obtain a list of function and fixed parameters (fnfp)
104h=type value f; [fnfp:value value f; (value[fnfp 0][1])!fnfp[1],a];
^
/get paramaters and make a dictionary with the arguments
q))\
q).pm.dict[`g;1 2 3] /incorrect result - b should be 2, c should be 3, d should be 4
| ::
a| 1
b| 1
c| 2
d| 3
q)
Each of the above cases should be supported, and unit tests covering each should be added to https://github.com/DataIntellectTech/TorQ/blob/master/tests/permissions/permissions.csv
In the permissions library (https://github.com/DataIntellectTech/TorQ/blob/master/code/handlers/permissions.q), there is some logic to handle projections. Specifically in the function
.pm.pdicthttps://github.com/DataIntellectTech/TorQ/blob/master/code/handlers/permissions.q#L76-L87, there is this code:The context here is that
fis a function name as a symbol, andaare the arguments that the user is passing. Here, wherefis pointing to a projection, the code needs to combine the fixed parameters with the user's argumentsa.However, the current implementation makes some assumptions
fnfp[1])awith fixed param)That means that this breaks on any projection with either multiple fixed params and/or fixed params other than first param.
For example, if we define following function & corresponding projections:
Only
gworks correctly with.pm.pdict. The others either throw an error (h,i), or give the incorrect output (j):Each of the above cases should be supported, and unit tests covering each should be added to https://github.com/DataIntellectTech/TorQ/blob/master/tests/permissions/permissions.csv