Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOC INIT { use Module; } fails if Module is not installed, even if --doc is not used #5059

Open
p6rt opened this issue Jan 17, 2016 · 4 comments
Open
Labels
RFC

Comments

@p6rt
Copy link

@p6rt p6rt commented Jan 17, 2016

Migrated from rt.perl.org#127293 (status was 'open')

Searchable as RT127293$

@p6rt

This comment has been minimized.

Copy link
Author

@p6rt p6rt commented Jan 17, 2016

From @hoelzro

For example​:

DOC INIT {
  use Pod​::EOD;
}

If Pod​::EOD is not installed, compilation of this code will fail, even if --doc is not used on the command line. On one hand, S26 implies that code inside of DOC INIT, DOC CHECK, and DOC BEGIN blocks is not executed if --doc is not used; on the other, use Module; statements are normally executed as soon as they're parsed.

@p6rt

This comment has been minimized.

Copy link
Author

@p6rt p6rt commented Aug 6, 2016

From @zoffixznet

Still present in Rakudo version 2016.07.1-88-g15ee3c3 built on MoarVM version 2016.07-11-g11e02fe

@p6rt

This comment has been minimized.

Copy link
Author

@p6rt p6rt commented Sep 21, 2016

From @smls

Without `--doc`, code inside a DOC block is not executed, but by necessity it still needs to be parsed.
And `use` performs its magic at parse time, not at execution time.

You could special-case DOC blocks so that any `use` statements (and other any compile-time things like phasers) that appear inside them, are ignored when `--doc` was not specified.
But that comes with complications​:

1) In case of a module, the precompilation system would have to store and manage two separate precompiled versions of the same file​: One for `--doc`, and one without. Alternatively, `--doc` would have to bypass precompilation.

2) A Pod​::* module wouldn't be able to export any symbols other than subroutines. If it exports any type names or operators, and the POD block code goes on to use those symbols, it would be a syntax error when run without `--doc` as the symbols wouldn't known to the parser in that case.

@p6rt

This comment has been minimized.

Copy link
Author

@p6rt p6rt commented Sep 21, 2016

The RT System itself - Status changed from 'new' to 'open'

@p6rt p6rt added the RFC label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.