WeBWorK Main Forum

Unquoted string warning (new in 2.19)

Unquoted string warning (new in 2.19)

by Sean Fitzpatrick -
Number of replies: 2

We have a few older problems that involve approximating difference quotient limits.

The problem works fine, but the solutions are now generating a non-fatal warning that never occurred in the past.

In the setup of the question, we introduce h as a variable:

Context()->variables->add(h => "Real");

We define a function $f and a non-zero random $a. The difference quotient is defined using

$diff = ($f->substitute(x=>"$a + x") - $f->eval(x=>$a))/x;

In the solution, we want to display the partially simplified difference quotient, and then the simplified version. We have a line like the following in a PGML solution:

The difference quotient [`\frac{f(a+h) - f(a)}{h}`] becomes [`[$diff->substitute(x=>h)->reduce()]`] which simplifies to [`[$simpl]+h`].

In the past this worked fine, but now we are getting the following warnings. It seems I can ignore them for now, but is there a way to fix this?

  • Non fatal warnings. These are only displayed for users with permission to view problem debugging info.
  • Unquoted string "h" may clash with future reserved word at line 1 of (eval 8170)
  • from within PGML::Eval called at line 937 of [PG]/macros/core/PGML.pl
  • from within PGML::Parse::replaceVariable called at line 898 of [PG]/macros/core/PGML.pl
  • from within PGML::Parse::stackText called at line 910 of [PG]/macros/core/PGML.pl
  • from within PGML::Parse::stackString called at line 783 of [PG]/macros/core/PGML.pl
  • from within PGML::Parse::terminateGetString called at line 261 of [PG]/macros/core/PGML.pl
  • from within PGML::Parse::Terminate called at line 159 of [PG]/macros/core/PGML.pl
  • from within PGML::Parse::Parse called at line 75 of [PG]/macros/core/PGML.pl
  • from within PGML::Parse::new called at line 1991 of [PG]/macros/core/PGML.pl
  • from within PGML::Format called at line 2009 of [PG]/macros/core/PGML.pl
  • from within PGML::Format2 called at line 112 of UlethMath/Calculus/01-Limits/1-Introduction/calc01118.pg

In reply to Sean Fitzpatrick

Re: Unquoted string warning (new in 2.19)

by Alex Jordan -

The 'x => h' is a perl error. The right operand of the "fat comma" shouldn't be a bare h. Try "h".

Also, I usually pass a Formula object with substitute. But maybe a plain string is ok if it can be Compute'd in the context.