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

Dealing with warnings in test-compilation of examples #1767

Closed
JJ opened this issue Feb 12, 2018 · 2 comments
Closed

Dealing with warnings in test-compilation of examples #1767

JJ opened this issue Feb 12, 2018 · 2 comments
Labels
xt Regarding current or new xt/ tests or the utils/

Comments

@JJ
Copy link
Contributor

JJ commented Feb 12, 2018

(Continues discussion in commit e01b3ca)
Some examples get warnings when test-compiled. Most are of this kind

WARNINGS for /home/jmerelo/Code/forks/perl6/doc/EVAL_76:
Useless use of constant string "..." in sink context (lines 4, 5)
ok 73 - doc/Language/5to6-perlfunc.pod6 chunk 12 starts with “q/.../” compiles

(You've probably realized I've added the starts with in 4eda9f8 to make the identication of said chunks easier)
This particular one relates to q/.../; # is still equivalent to using single quotes. which is a syntactically fine construct, but it's not so good according to this issue #1748 I raised some time ago: express intent with examples. My point is that warnings warn about something, and maybe we should pay some attention to them.
Besides, there are not so many, and they can be dealt with easily. It can help improve the documentation too. Probably not a priority, but useful anyway.
Another option is to add :skip-test to those pieces of code, and of course to turn warnings into errors.

JJ referenced this issue Feb 12, 2018
But this is style more than a bug. Actually, there were no errors in
the code with the latest version of Rakudo, so this closes #1766
@JJ JJ added the xt Regarding current or new xt/ tests or the utils/ label Feb 12, 2018
@coke
Copy link
Collaborator

coke commented Feb 12, 2018

Each example code is not intended to be a standalone, working program. Often times we're showcasing something very specific in terms of functionality or syntax, and the examples are intended to be used as part of a larger program.

To this end, we've gone so far as to allow pre-declared code that is included when compiling the example, but is invisible when rendered to the user. (e.g. in your recent change to $list, we could declare "$list" outside the code block itself, so we didn't have to have the variable declaration in the code where we're showing lists, not variables.

So I think forcing each section to be warnings free and include the code is actually getting away from the intent; the intent is often to show a very particular thing. I agree, however, that the examples could in general stand to be reviewed; but I don't agree that making them warnings free is a goal in and of itself. (Note that we're already doing what we can to ignore many types of warnings, e.g. https://github.com/perl6/doc/blob/master/xt/examples-compilation.t#L91 and I intend to update the example compiler to ignore more of them to avoid noisy test output.

@JJ
Copy link
Contributor Author

JJ commented Feb 12, 2018

Fair enough. I'll close the issue then, unless you want to keep it open as a reminder to update the example compiler. Right now there are only two types of warnings: one is that one illustrated above and the other is Space is not significant here;

@JJ JJ closed this as completed Feb 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
xt Regarding current or new xt/ tests or the utils/
Projects
None yet
Development

No branches or pull requests

2 participants