Hi @00shiv,
If I understand right, I think the following will work.
proc foo(D1, D2): ([D1] int, [D2] int) {
var a = [i in D1] i;
var b = [i in D2] i;
return (a, b);
}
This assumes the domains are passed to the function. If they are computed in the function body, you can still specify the return type (as long as they are computable solely passed on the function formals). For example
proc getDom(low, high) {
return {low..high};
}
proc bar(low, high): ([getDom(low, high)] int, [getDom(low, high)] int) {
const D = getDom(low, high);
var a = [i in D] i;
var b = [i in D] i;
return (a, b);
}
The query syntax you wrote in the OP isn't valid for a return type, but usually you can omit the domain expression for an array return type. For example the following works.
proc bar(low, high): [] int {
const D = getDom(low, high);
var a = [i in D] i;
return a;
}
However, making it a tuple doesn't work (which might also be what you ran into)
proc bar(D1, D2): ([] int, [] int) {
var a = [i in D1] i;
var b = [i in D2] i;
return (a, b);
}
I'm fairly sure this one not working is a bug and you should open a github issue for it if you need it.
If this is the kind of pattern you need to support, where the domain is not knowable by the function formals and you truly want/need ([] int, [] int), your best bet for the time being is to just omit the return type (and maybe have it as a comment since presumably you want it for a strict coding style?).
-Jade