nqp icon indicating copy to clipboard operation
nqp copied to clipboard

LTA error msg for unknown object

Open tbrowder opened this issue 8 years ago • 5 comments

Using a recent nqp REPL on a Debian 8 host:

$ nqp

c() Cannot invoke this object (REPR: Null; VMNull)

A clearer msg would be something like “object ‘c’ is unknown” or “...undefined”.

tbrowder avatar Nov 01 '17 22:11 tbrowder

This triggers a MoarVM error message from https://github.com/MoarVM/MoarVM/blob/master/src/core/frame.c#L1756

Not sure if we can make the nqp handle this better since it's not Perl 6. How can we make the error message better? I don't know if i can access the function name the user tried to input. If @jnthn can confirm?

samcv avatar Nov 02 '17 06:11 samcv

Even if the object name can’t be identified, is the “Cannot invoke” msg used in other cases so a list of possibilities could be presented?

In retrospect I should have thought of the misspelling earlier, but the msg to this novice “invokes” horrible images of corruption in the guts of rakudo for a malformed object.

tbrowder avatar Nov 02 '17 09:11 tbrowder

The best fix for this would be to implement detection of undeclared routines in NQP (using a mechanism like the %*MYSTERY hash in Rakudo's grammar). That way, things with undeclared subroutines wouldn't make it past compilation, just as is the case in Rakudo.

jnthn avatar Nov 02 '17 10:11 jnthn

sounds like a plan

tbrowder avatar Aug 27 '18 11:08 tbrowder

Same error message for me when trying to use say in a BEGIN (apparently I shouldn't do that :) ). Cygwin x64, static MoarVM 2018.11, nqp 2018.11, running with MVM_SPESH_DISABLE=1 MVM_SPESH_INLINE_DISABLE=1 MVM_SPESH_OSR_DISABLE=1 MVM_JIT_DISABLE=1:

$ ./nqp-m -e 'BEGIN { say(1); }'
Cannot invoke this object (REPR: Null; VMNull)
   at -e:1  (<ephemeral file>:)
 from gen/moar/stage2/NQP.nqp:396  (nqp.moarvm:)
 from gen/moar/stage2/NQP.nqp:609  (nqp.moarvm:run_begin_block)
 from gen/moar/stage2/NQP.nqp:2547  (nqp.moarvm:statement_prefix:sym<BEGIN>)
 from gen/moar/stage2/QRegex.nqp:1654  (QRegex.moarvm:!reduce)
 from gen/moar/stage2/QRegex.nqp:1597  (QRegex.moarvm:!cursor_pass)
 from <unknown>:1  (nqp.moarvm:statement_prefix:sym<BEGIN>)
 from gen/moar/stage2/QRegex.nqp:1694  (QRegex.moarvm:!protoregex)
 from <unknown>:1  (nqp.moarvm:statement_prefix)
 from <unknown>:1  (nqp.moarvm:term:sym<statement_prefix>)
 from gen/moar/stage2/QRegex.nqp:1694  (QRegex.moarvm:!protoregex)
 from <unknown>:1  (NQPHLL.moarvm:term)
 from <unknown>:1  (NQPHLL.moarvm:termish)
 from gen/moar/stage2/NQPHLL.nqp:995  (NQPHLL.moarvm:EXPR)
 from gen/moar/stage2/NQP.nqp:954  (nqp.moarvm:statement)
 from <unknown>:1  (nqp.moarvm:statementlist)
 from gen/moar/stage2/NQP.nqp:921  (nqp.moarvm:comp_unit)
 from gen/moar/stage2/NQP.nqp:819  (nqp.moarvm:TOP)
 from gen/moar/stage2/QRegex.nqp:2301  (QRegex.moarvm:parse)
 from gen/moar/stage2/NQPHLL.nqp:2035  (NQPHLL.moarvm:parse)
 from gen/moar/stage2/NQPHLL.nqp:1951  (NQPHLL.moarvm:execute_stage)
 from gen/moar/stage2/NQPHLL.nqp:1984  (NQPHLL.moarvm:run)
 from gen/moar/stage2/NQPHLL.nqp:1987  (NQPHLL.moarvm:)
 from gen/moar/stage2/NQPHLL.nqp:1973  (NQPHLL.moarvm:compile)
 from gen/moar/stage2/NQPHLL.nqp:1667  (NQPHLL.moarvm:eval)
 from gen/moar/stage2/NQPHLL.nqp:1796  (NQPHLL.moarvm:)
 from gen/moar/stage2/NQPHLL.nqp:1851  (NQPHLL.moarvm:command_eval)
 from gen/moar/stage2/NQPHLL.nqp:1777  (NQPHLL.moarvm:command_line)
 from gen/moar/stage2/NQP.nqp:4137  (nqp.moarvm:MAIN)
 from gen/moar/stage2/NQP.nqp:4132  (nqp.moarvm:<mainline>)
 from <unknown>:1  (nqp.moarvm:<main>)
 from <unknown>:1  (nqp.moarvm:<entry>)

cxw42 avatar Dec 07 '18 18:12 cxw42