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
Let's remove most (if not all) perl5-oriented error messages for variables #1356
Comments
|
👍 on removing them. I'm a Perl 5 programmer who came to Perl 6 and these Perl5-ism errors were never helpful to me and only got in my way when I wrote proper Perl 6 code. |
|
What other context would people be using those variables? Do they actually get in the way, or is it more you make a typo and instead of getting a syntax error get one of these? |
Depends on the variable. Some of them could be properly used in Perl 6, but their use is entirely blocked by these error messages: My main argument against these is they assume too much. A novice Perl 6 programmer who never programmed Perl 5 might be utterly confused why they're being recommended "Form module" when they tried to write an implicit signature. It's a given that the vast majority of Perl 6 code is written by people who know Perl 6 and not by novices who'd might benefit from these errors. Yet, it's that majority that has to suffer and work-around these errors. It's not just the variables either. I never wrote C++ in my life, yet the compiler blocks me from using perfectly valid Perl 6 code: I'm perfectly aware of how IMO any such thing that blocks valid Perl 6 code should be removed and placed into "NoviceHelpers::Perl5", slang module that enables all these errors. The beginners could load whatever module they need and the module can implement even more of such features and be more targeted to other languages as well. And I'm not buying the argument that beginners wouldn't know to load such a module. They learned to put the useless |
|
I'm sorta in two minds about this, especially regarding: https://www.perl.com/article/an-open-letter-to-the-perl-community/ . The thing is that many of these date from ~15 years ago: Perl 5 has evolved since then, so in some cases they refer to older false friends. I mean, the bare |
To me, the issue isn't the references to other languages, but the errors interrupting my flow when I write perfectly valid Perl 6 code. |
|
This has been brought up on IRC in the past, and I think someone suggested making such errors/warnings opt-in via an environment variable or |
|
The opt-in suggestion reminds me a bit of php.ini and all the issues global configuration of a language causes. An environment variable would e.g. be propagated to module compilation. So using code from a Perl 6 pro in a program written by a newbie coming from Perl 5 would become harder. I have found all the P5ism error messages to be incredibly helpful when learning Perl 6. And I've told my fellow colleagues to just try the Perl 5 code and follow the error message when they don't know what a thing is called in Perl 6. So I'd hate to lose this help. Maybe we could just weed out the rather obscure variables like everything that has got to do with formats? |
I imagined the opt-in would be implemented as simply an alternate exceptions handler. We already support them. And if any cases remain where that can't be handled by examining the Exceptions objects in the handler could be handled with a slang instead. Thus, the new users coming from other languages would be told to just load a module (e.g.
That's contrary to my experience. (I did come to Perl 6 from Perl 5) |
|
I also found the Perl 5 error messages in general very useful. It would be a mistake to remove significant ones based on sour grapes over a reddit thread. The ones referenced would be useful in catching the occasional typo -- especially if someone is context switching between 5 and 6. |
What reddit thread? I see none mentioned in this issue, which existed for over 21 days. The proposal is to move these errors into the ecosystem. This would eliminate the assumption that every newcomer is a Perl 5 programmer and only the programmers who'd actually benefit from these errors would be blocked from using valid Perl 6 features. This would also encourage users to implement other similar modules, for other languages. |
|
My feeling is:
For example, As to the |
|
If they have to stay I'd at least like some way to express …I really don't need things like this in the middle of a very long day of grammar debugging. There's no ambiguity there, the compiler can even see I've used the thing it's telling me to use. But most of all I want to work in one language, not be constantly paranoid about the compiler automatically taking offence to imagined slights and getting in my face on some unrelated language's behalf. They do that more than enough manually already! |
Just got burnt on that myself: Wasted some time just because some other language I'm not even coding in uses this syntax for character ranges. |
|
Related IRC discussion: https://irclog.perlgeek.de/perl6/2018-05-13#i_16159259 TL;DR some of these messages are very outdated (e.g. |
Not enough people using perlform, so it's hard to justify support for these error messages. Moreover, Perl 6 Form module is still unfinished, so the recommendation to use it is somewhat unhelpful. Note that some of the removed variables from Exception.pm6 were not even implemented. Also note that $^A and $^L are still illegal (like all 1-char uppercase $^ vars), so now for these two vars it simply won't recommend the unfinished module. Part of #1356.
“Deprecated in Perl 5. Removed in Perl v5.10.0.” If anybody ever ports their perl4 scripts directly to Perl 6 I'll eat my bots. Part of #1356.
The error message is not implemented anyway and was simply listed in Exception.pm6. Deprecated in Perl v5.12.0. From perl5 docs: “Under `use v5.16`, $[ no longer has any effect, and always contains 0. Assigning 0 to it is permitted, but any other value will produce an error.” Part of #1356.
Also tweak some messages to reflect reality. Part of #1356.
Removing tests to match current rakudo behavior. Part of rakudo/rakudo#1356.
|
8ae82a558b addresses this in some form, apart from exposing some bugs with constructs that used to be blocked by the X::Obsolete throwage: https://irclog.perlgeek.de/perl6-dev/2018-05-17#i_16175545 |
Not enough people using perlform, so it's hard to justify support for these error messages. Moreover, Perl 6 Form module is still unfinished, so the recommendation to use it is somewhat unhelpful. Note that some of the removed variables from Exception.pm6 were not even implemented. Also note that $^A and $^L are still illegal (like all 1-char uppercase $^ vars), so now for these two vars it simply won't recommend the unfinished module. Part of rakudo#1356.
“Deprecated in Perl 5. Removed in Perl v5.10.0.” If anybody ever ports their perl4 scripts directly to Perl 6 I'll eat my bots. Part of rakudo#1356.
The error message is not implemented anyway and was simply listed in Exception.pm6. Deprecated in Perl v5.12.0. From perl5 docs: “Under `use v5.16`, $[ no longer has any effect, and always contains 0. Assigning 0 to it is permitted, but any other value will produce an error.” Part of rakudo#1356.
Also tweak some messages to reflect reality. Part of rakudo#1356.
|
Another case where a perfectly valid program errored out on me because it thinks I'm writing in a language in which I never even used |
|
So it looks like the current course of action is to remove some (particularly outdated) Perl-5ism error messages altogether, while the rest continues to always block compilation when encountered? Wouldn't it make more sense to:
For example:
And so on...
Helpful in explaining the source of a syntax error, or helpful in stopping the compilation of a Perl 6 program that would have otherwise compiled (but done the wrong thing due to the p5ism thinko)? Can you help collect some more examples of the latter? |
|
Here is a user getting tripped by the "help" from Perl 5 errors, confused why valid syntax is invalid in this case: |
|
My take on this now is: |
cue Perl 5 folks rioting |
|
Wouldn't it make more sense to invert the logic (given that we're making it the default anyway) and call it |
|
Yes, I like this more than the other. It's just a silly thing to pick on a valid syntax in this language just because some other also has it. |
Removing tests to match current rakudo behavior. Part of rakudo/rakudo#1356.
See these tests: https://github.com/perl6/roast/blob/1f54bd963c2d75a7b7b28a17777def4682c28436/S32-exceptions/misc.t#L195-L207
Really, only a few of those are actually helpful (although I can no longer tell which ones because I don't write any perl5 code nowadays). The rest just gets in the way when you don't even think about perl 5.
Most importantly, I want to break “perl6 is the next version of perl5” connection as much as we can. Giving less error messages like this is going to help with that.
The text was updated successfully, but these errors were encountered: