在nqp中,您可以在nqp哈希表或nqp列表上创建迭代器。我希望能够找出给定的nqp迭代器是否在哈希或列表上进行迭代。las,我还没有找到一种方法。他们甚至似乎使用相同的名称:
use nqp;
dd nqp::iterator(nqp::hash).^name; # BOOTIter
dd nqp::iterator(nqp::list).^name; # BOOTiter
Run Code Online (Sandbox Code Playgroud)
这样的nqp迭代器似乎确实知道它是什么类型:
use nqp;
nqp::iterkey_s(nqp::iterator(nqp::list));
# This is not a hash iterator, it's a VMIter (BOOTIter)
Run Code Online (Sandbox Code Playgroud)
建议欢迎!