Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 3e65ae5cd034e4d51a76b3715fe89a72cf01e615
Ticket: 2010909fffffffffffffffffffffffffffffffff
clock scan fails with %V
User & Date: ferrieux on 2008-07-05 22:53:24
Changes

  1. icomment:
    Logged In: YES 
    user_id=496139
    Originator: NO
    
    Hmm, you seem to be concentrating on under-specification of the input string, while I think it is useful to define it for the format string instead (the only circumstance under which "2008 04" should be reasoned about ex nihilo, is free-form-scanning. We are not in this case, we do have a format string.).
    
    Then, we can define the "compatibility principle" in a very simple fashion:
    
      [clock format [clock scan $s -format $f] -format $f]
      is always "nearly equal" to $s (except for whitespace
      and other irrelevant chars)
    
    This means that for "underspecified formats" like "%Y %V", [clock scan] is free to *choose* (as in "not specified") among several values, provided the above equation holds. This choice can be driven by simplicity of implementation, or by some objective function to optimize (like "closest to now").
    
    Kevin, don't you think this compatibility principle would be a good guide ?
    If we admit it, then clearly the current behavior with %V is a bug...
    (But please also notice that enforcing it would not require a TIP, since I can't imagine a purposeful use of "%Y %V" returning a date in the wrong week for example).
    
    
  2. login: "ferrieux"
  3. mimetype: "text/plain"
  4. username: "ferrieux"