Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: f77e0fdcd81551b6fc79890fe7f069f4edd98509791eb1e97773bf8208599304
Ticket: cd61f085da52b3384388c8ef780f53d8c55ead4f
tcl terminates silently with invalid expr underscore syntax and radix prefix
User & Date: juliannoble2 on 2023-08-29 17:47:55
Changes

  1. icomment:
    Just as a further reason why I think the rules for underscores need to be very simple and understandable and why the underscores shouldn't be allowed adjacent to e|E:
    
    
    #1
    % set x 1.e_2
    1.e_2
    % expr {$x < 100}
    0
    
    #2
    % set x 1.e_+2
    1.e_+2
    % expr {$x < 100}
    1
    
    
    #2 gets us right back to accidental string comparison (though this example is just an artifact of the current state of the fix)
    
    if you allow 1.0_e2  but then disallow 1._e2  to be consistent with disallowing 1._1 & 1_.1 then this also risks accidental string comparison for those assuming 'before e|E is always ok'.
    
    If the current fix allowing 1._1 is intentional - then the risk is misinterpretation of the rules to think 1_._1 and/or 1_.1 are ok - as well as the previously mentioned surprise for those splitting on the dot and getting a string in part b even after having already filtered out sci notation.
    
    By disallowing anywhere but in between digits and perhaps after radix spec - it would seem to alleviate this risk.
    
  2. login: "juliannoble2"
  3. mimetype: "text/plain"