chapel-users/developers,

found a small issue and was unsure if this is an expected or unexpected
feature.

::variable arguments, tuple expansion::

proc callb(kargs...?k) {
  writeln(kargs);
}

proc calla(kargs...?k) {
  writeln(kargs);
  callb(kargs);
}

calla(1,2,3);

the output is:

(1,2,3)
((1,2,3))

at the moment, i can "sort of" hack around this issue by expanding the
kargs tuple prior to calling callb in the function calla

proc calla(kargs...?k) {
  writeln(kargs);
  callb((...kargs));
}

:: params use ::

when passing particularly complex, non-homogenous tuples into kargs
(example: calla((1,2), (3, "cat"))) are there best practices?

i've a program in which the kargs tuple going into calla needs to be passed
around to several smaller functions in calla and there have been a couple
occasions in which the compiler will claim "error: invalid access of
non-homogeneous tuple by runtime value" or "Types.chpl:356: error: Function
'isHomogenousTuple' has been instantiated too many times note: If this is
intentional, try increasing the instantiation limit from 256".

in these cases, i've had some success annotating the value used to index
kargs a param.

thanks!
ct
------------------------------------------------------------------------------
_______________________________________________
Chapel-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-users

Reply via email to