From World.nqp, line 3602 :
nqp::if(
nqp::istype(nqp::atpos($task,3),$!Block),
QAST::Op.new( :op<call>,
QAST::WVal.new(:value(nqp::atpos($task,3))),
$self,
$getattr
),
nqp::if(
nqp::iseq_i($code,5),
QAST::IVal.new(:value(nqp::atpos($task,3))),
QAST::NVal.new(:value(nqp::atpos($task,3)))
)
),
whereas from World.nqp, line 3314 :
if $invocant_type =:= $!acc_sig_cache_type {
$sig := $!acc_sig_cache;
}
# First time, create new signature and mark it cached
else {
$sig := $!w.create_signature_and_params(
NQPMu, %sig_empty, $block, 'Any', :method, :$invocant_type);
$!acc_sig_cache := $sig;
$!acc_sig_cache_type := $invocant_type;
}
I thought the last form of if
(without nqp::
) in front was not allowed unless if
was a builtin? See NQP Built-in Subs List.
The first form, nqp::if
, is described in the NQP Opcode List,
however I could not find documentation for the second form, though
it seems to be the most common form in the Rakudo source tree.
Why are there two forms of if
statements in NQP?