octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #62824] Syntax error in uitable demo example


From: Philip Nienhuis
Subject: [Octave-bug-tracker] [bug #62824] Syntax error in uitable demo example
Date: Wed, 27 Jul 2022 15:31:33 -0400 (EDT)

URL:
  <https://savannah.gnu.org/bugs/?62824>

                 Summary: Syntax error in uitable demo example
                 Project: GNU Octave
               Submitter: philipnienhuis
               Submitted: Wed 27 Jul 2022 09:31:32 PM CEST
                Category: Documentation
                Severity: 2 - Minor
                Priority: 5 - Normal
              Item Group: Documentation
                  Status: None
             Assigned to: None
         Originator Name: Philip Nienhuis
        Originator Email: 
             Open/Closed: Open
                 Release: dev
         Discussion Lock: Any
        Operating System: Any


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Wed 27 Jul 2022 09:31:32 PM CEST By: Philip Nienhuis <philipnienhuis>
Another one from the nitty-gritty dept.:

The third example in uitable.m's help ("long demo with callbacks") contains
syntax errors in the first assignment statement, see below for a copy of part
of the code:

## Long demo with callbacks
function uitable_demo ()
  f = figure ("Name", "uitable Demo", "Menu", "none", ...
              "Position", [10 10 1000 680]);

  ## A basic example
  d = { "char"   , "A string";
        "double" , 12.3456789;
        "complex", 1+2i;
        "bool"   , true;
        "single" , single (12.3456789);
        "int8"   , int8 (-128);
        "uint8"  , uint8 (128);
        "int16"  , int16 (-32768);
        "uint16" , uint16 (32768);
        "int32"  , int32 (-2147483648);
        "uint32" , uint32 (2147483648);
        "int64"  , int64 (-2147483649);
        "uint64" , uint64 (2147843649)};

  ## Skipping rest of code

endfunction


... where of course Octave errors on the call to 'single' on the 5th line of
the assignment to variable "d". Reason: space between function 'single' and
its argument within a concatenation statement, i.e. between {...} or [...].
I myself hit this when bluntly copying the function into the editor and
blindly running it but quickly saw the culprit. However, unwary users that
blindly trust in correctness of Ocatev's demo code may be a bit put off.

Q: how do we deal with these kind of syntax errors in demos and examples?

I'd say it should be corrected, but then the demo syntax may not look that
"nice" (not that I care).
Should we remove the spaces between the function names single, int8, uint8,
... and their arguments, or enclose those calls in parentheses?








    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?62824>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]