Don't 'say' anything.  Just let the optimizer spit out the QAST that you
are interested in looking at.
The following spits out a diff after optimization:

# diff -u <(perl6 --target=optimize -e '"test".IO.e') <(perl6
--target=optimize -e '"test".IO.e.Bool')

>> Huh.  Not sure what I am looking at

You aren't specific.  Is it the error message you received because you used
'say' improperly or is it the QAST?
- How to use 'say' is in the documentation.
- A QAST is pretty close to an AST and I'd start there on wikipedia or
something.

On Mon, May 18, 2020 at 1:03 AM ToddAndMargo via perl6-users <
perl6-users@perl.org> wrote:

> On 2020-05-17 21:48, Paul Procacci wrote:
> > You can check this yourself by looking at the QAST nodes after the
> > static analyzer has had its fill:
> >
> > # diff -u <(perl6 --target=optimize -e '"test".IO.e') <(perl6
> > --target=optimize -e '"test".IO.e.Bool')
>
> Huh.  Not sure what I am looking at
>
>
> $ diff -u <(perl6 --target=optimize -e 'say if "test".IO.d') <(perl6
> --target=optimize -e 'say "test".IO.d.Bool')
> ===SORRY!=== Error while compiling -e
> Unsupported use of bare "say"; in Raku please use .say if you meant to
> call it as a method on $_, or use an explicit invocant or argument, or
> use &say to refer to the function as a noun
> at -e:1
> ------> say⏏ if "test".IO.d
> --- /dev/fd/63  2020-05-17 22:01:37.947790677 -0700
> +++ /dev/fd/62  2020-05-17 22:01:37.948790659 -0700
> @@ -0,0 +1,98 @@
> +- QAST::CompUnit  :W<?> :UNIT<?> :CAN_LOWER_TOPIC<?>
> +  [pre_deserialize]
> +    - QAST::Stmt
> +      - QAST::Stmt
> +        - QAST::Op(loadbytecode)
> +          - QAST::VM
> +            [moar]
> +              - QAST::SVal(ModuleLoader.moarvm)
> +            [jvm]
> +              - QAST::SVal(ModuleLoader.class)
> +            [js]
> +              - QAST::SVal(ModuleLoader)
> +        - QAST::Op(callmethod load_module)
> +          - QAST::Op(gethllsym)
> +            - QAST::SVal(nqp)
> +            - QAST::SVal(ModuleLoader)
> +          - QAST::SVal(Perl6::ModuleLoader)
> +      - QAST::Op(forceouterctx)
> +        - QAST::BVal(2)
> +        - QAST::Op(callmethod load_setting)
> +          - QAST::Op(getcurhllsym)
> +            - QAST::SVal(ModuleLoader)
> +          - QAST::SVal(CORE.d)
> +  [post_deserialize]
> +    - QAST::Stmts
> +      - QAST::Op(bind)
> +        - QAST::Var(attribute $!do)
> +          - QAST::WVal(Block)
> +          - QAST::WVal(Code)
> +        - QAST::BVal(1)
> +    - QAST::Op(bindcurhllsym)
> +      - QAST::SVal(GLOBAL)
> +      - QAST::WVal(GLOBAL)
> +  [load]
> +    - QAST::Op(call)
> +      - QAST::BVal(2)
> +  [children]
> +    - QAST::Block(:cuid(2))  :in_stmt_mod<?> say \"test\".IO.d.Bool
> +    │ - QAST::Var(local __args__ :decl(param))
> +    │ - QAST::Stmts  say \"test\".IO.d.Bool
> +    │ - QAST::Op(call)
> +    │   - QAST::Block(:cuid(1) :blocktype(declaration_static))
> :outer<?> :in_stmt_mod<?> :code_object<?> :IN_DECL<mainline>
> +    │   │ - QAST::Stmts  say \"test\".IO.d.Bool
> +    │   │   - QAST::Var(lexical $¢ :decl(contvar))
> +    │   │   - QAST::Var(lexical $! :decl(contvar))
> +    │   │   - QAST::Var(lexical $/ :decl(contvar))
> +    │   │   - QAST::Op(null)
> +    │   │   - QAST::Var(lexical GLOBALish :decl(static))
> +    │   │   - QAST::Var(lexical EXPORT :decl(static))
> +    │   │   - QAST::Var(lexical $?PACKAGE :decl(static))
> +    │   │   - QAST::Var(lexical ::?PACKAGE :decl(static))
> +    │   │   - QAST::Var(lexical $=finish :decl(static))
> +    │   │   - QAST::Var(lexical $=pod :decl(static))
> +    │   │     [value]
> +    │   │       -
> +    │   │   - QAST::Var(lexical !UNIT_MARKER :decl(static))
> +    │   │ - QAST::Stmts
> +    │   │   - QAST::Op(bind)
> +    │   │     - QAST::Var(local ctxsave :decl(var))
> +    │   │     - QAST::Var(contextual $*CTXSAVE)
> +    │   │   - QAST::Op(unless)
> +    │   │     - QAST::Op(isnull)
> +    │   │       - QAST::Var(local ctxsave)
> +    │   │     - QAST::Op(if)
> +    │   │       - QAST::Op(can)
> +    │   │         - QAST::Var(local ctxsave)
> +    │   │         - QAST::SVal(ctxsave)
> +    │   │       - QAST::Op(callmethod ctxsave)
> +    │   │         - QAST::Var(local ctxsave)
> +    │   │ - QAST::Stmts
> +    │   │   - QAST::WVal(Array)
> +    │   │   - QAST::Stmt <sunk final> say \"test\".IO.d.Bool
> +    │   │     - QAST::Want <sunk>
> +    │   │       - QAST::Op(callstatic &say) <sunk> :statement_id<1> say
> \"test\".IO.d.Bool
> +    │   │         - QAST::Op(hllize) <wanted>
> +    │   │           - QAST::Op(callmethod Bool)  Bool
> +    │   │             - QAST::Op(hllize) <wanted>
> +    │   │               - QAST::Op(callmethod d)  d
> +    │   │                 - QAST::Op(hllize) <wanted>
> +    │   │                   - QAST::Op(callmethod IO)  IO
> +    │   │                     - QAST::Want <wanted> test
> +    │   │                       - QAST::WVal(Str)
> +    │   │                       - Ss
> +    │   │                       - QAST::SVal(test)
> +    │   │       - v
> +    │   │       - QAST::Op(p6sink)
> +    │   │         - QAST::Op(callstatic &say) <sunk> :statement_id<1>
> say \"test\".IO.d.Bool
> +    │   │           - QAST::Op(hllize) <wanted>
> +    │   │             - QAST::Op(callmethod Bool)  Bool
> +    │   │               - QAST::Op(hllize) <wanted>
> +    │   │                 - QAST::Op(callmethod d)  d
> +    │   │                   - QAST::Op(hllize) <wanted>
> +    │   │                     - QAST::Op(callmethod IO)  IO
> +    │   │                       - QAST::Want <wanted> test
> +    │   │                         - QAST::WVal(Str)
> +    │   │                         - Ss
> +    │   │                         - QAST::SVal(test)
> +    │   │   - QAST::WVal(Nil)
>


-- 
__________________

:(){ :|:& };:

Reply via email to