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

use statement when improperly terminated gives difficult-to-interpret error message #5469

Open
jubilatious1 opened this issue Nov 14, 2023 · 1 comment
Labels
LTA Less Than Awesome; typically an error message that could be better

Comments

@jubilatious1
Copy link

The Problem

use statement when improperly terminated gives difficult-to-interpret error message

Steps to Reproduce

Tried some code from @antononcube 's excellent Text::Plot module but forgot to add terminating semicolon (i know, i know).

Started script with use Text::Plot instead of use Text::Plot;

use Text::Plot

my @xs = (0, 0.2 ... 5);
say text-list-plot(@xs, @xs>>.sin,
        x-label => 'x-points',
        y-label => 'value',
        y-tick-labels-format => '%10.2e',
        width => 80,
        height => 18,
        title => 'SINE PLOT');

Received error message:

�[31m===�[0mSORRY!�[31m===�[0m Error while compiling -
Error while importing from 'Text::Plot':
no EXPORT sub, but you provided positional argument in the 'use' statement
at -:3
------> �[32mmy @xs = (0, 0.2 ... 5)�[33m⏏�[31m;�[0m
    expecting any of:
        postfix

Maybe the above error message can be improved?

'use' statement possibly unterminated, or no EXPORT sub provided for positional argument

Environment

  • Operating system: MacOS Ventura
  • Compiler version (rakudo -v or raku -v): 2023.05
@ab5tract ab5tract added the LTA Less Than Awesome; typically an error message that could be better label Dec 3, 2023
@ab5tract
Copy link
Collaborator

ab5tract commented Dec 3, 2023

This is an interesting one.

My first thought is that we could state that there must be no newline between a use statements and its first qualified import.

use Foo <a
         vertical
         list>;  # This is fine

vs

use Foo
    <a list of imports>; # This is not fine

But maybe someone has a more elegant solution in mind?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LTA Less Than Awesome; typically an error message that could be better
Projects
None yet
Development

No branches or pull requests

2 participants