Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 012fa0a4d5998336f069eff5180dd98928a71b2336c63f0b6f03f4f1e2e70b95
Ticket: f4a4bd7f107031f273642cbaefc3cbed72315b1f
lseq "count" argument also dictates output formatting
User & Date: apnadkarni on 2024-09-08 16:55:51
Changes

  1. closedate changed to: "2460562.2054602"
  2. closer changed to: "apnadkarni"
  3. icomment:
    I'll point out this is (I think) the **only** place in Tcl where floating point representations of whole numbers are accepted as counts (or indices for that matter). Consider
    
    ```
    % string repeat x 2.0
    expected integer but got "2.0"
    % lrepeat 2.0 x
    expected integer but got "2.0"
    % # BUT
    % lseq 2.0
    0.0 1.0
    ```
    
    So I'm not sure about the basis for Nathan's comment "*prohibiting 3.0 as the value of the count argument would be less intuitive and more awkward. Artificial constraints like that have generally been avoided for Tcl.*". As seen above, Tcl does in fact have this constraint (artificial or not is a matter of opinion).
    
    As a further aside, also with regards to Nathan's comment, and the `expr 3==3.0` example, compare `expr 1/3` with `expr 1/3.0`. So not sure about the basis for the statement "*3.0 and 3 have the same meaning*" either. At least not in Tcl.
    
    I'd prefer consistency between arguments that are treated as counts (accept floats everywhere or nowhere) but shrug...
    
  4. login: "apnadkarni"
  5. mimetype: "text/x-markdown"