[Nickle] Bugs with new output formatting

Barton C Massey bart at cs.pdx.edu
Wed Oct 17 16:15:53 PDT 2007


Unfortunately, the new output formatting seems to have some
problems...


  > 1/(2**64-1)

Hangs trying to output.  This used to spit something
sensible.


  > 1/3
  0.3

In general it appears that the curly braces are simply
omitted, without expanding the value in any reasonable way.
This seems to be the case even if "infinite precision" is
specified---I can't find any way to get the curly braces
*back*.

  > printf("%.-g\n", 1/10!);
  0.00000027557319223985890652


  > format = "%g";
  > format = "%f";
  Unhandled exception invalid_argument ("realformat with non-real", 1, "%f")
  /usr/share/nickle/printf.5c:186:
      raise invalid_argument ((fmts[i]).message + "format with non-" + (fmts[i]).message, 1, this_arg);
      fprintf (file, "%f")
 /usr/share/nickle/command.5c:20:
      printf (format, v);
      display ("%f")
 <stdin>:5:     Command::display ((format = "%f"));
 -
      
It's never been obvious to me why the first format command
is acceptable, but the second is not :-).


I'm not sure what to do about all this.  I think the user
should be able to select between a "%f"-like or "%g"-like
output format and the old format with the curly braces for
repeats using the format variable.  I also think that Nickle
should accept curly-repeats on the input, although I know
that's a pain in the neck.

Keithp?

    Bart


More information about the Nickle mailing list