1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Am I just crazy, or ...

Discussion in 'Support' started by mathewsdw, Jan 19, 2012.

  1. mathewsdw

    Joined:
    May 24, 2010
    Messages:
    855
    Likes Received:
    0
    has there been a "significant" change that I've never noticed in the "What's New" section of any previous release?

    As usual, using a TCC "log" to "illustrate" the issue:

    Code:
      Thu  Jan 19, 2012  8:37:05p
     
    TCC  12.11.76  Windows 7 [Version 6.1.7601]
    Copyright 2011  Rex Conn & JP Software Inc.  All Rights Reserved
    Registered to Daniel Mathews
     
    [Z:\]Set ABC=QRS
    [Z:\]Set ABCDEF=MNO
    [Z:\]Echo %ABC
    QRS
    [Z:\]Echo %ABCDEF
    MNO
    [Z:\]
    

    Frankly, what I expected that last "Echo" command to produce (and I'm close to 100% sure that this is what it used to produce at least at some time in the past) is "QRSDEF", i.e., the variable named "ABC" completely "covered" or "obscured" variables named ABC<anythingelse>.

    This is definitely a major improvement in my mind if it is, in fact, a change (and when that happened if that happened; things work as above in the earliest release of TCC I have access to - Version 9); but I can't help but wonder if this is really a change or my memory is just playing "tricks" on me again...

    - Dan

    P. S. And you really don't need to answer the "Am I just crazy" question... :)
     
  2. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,307
    Likes Received:
    39
    Not a change -- it's always worked like that. If you want to expand the shorter variable name, you can:
    Code:
    echo %ABC%DEF
    
    or
    Code:
    echo %[ABC]DEF
    
     
  3. mathewsdw

    Joined:
    May 24, 2010
    Messages:
    855
    Likes Received:
    0
    Thank you, Charles, (I think :)) you just proved that I'm just crazy. You see, I've been making an effort (by strictly (as in carefully) using a "naming convention" where the full name of no variable matched the beginning characters of any other variable) for as long as I can remember (and my memory didn't start going until about 10 years ago so that's not an issue), and, while I really wouldn't call doing that much of a problem (at this point in my life it's fairly "automatic"), I can't help but wonder when, how, and where I got the idea that I had to do that in the first place...
     
  4. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,860
    Likes Received:
    83
    The only place this is true is in FOR arguments, where (for CMD compatibility) TCC will match a single-character FOR variable with any longer variable name that begins with that character. For example:

    for %a in (a b c) do echo %aardvark

    will return:

    aardvark
    bardvark
    cardvark

    and not the value of the environment variable named AARDVARK.
     
  5. mathewsdw

    Joined:
    May 24, 2010
    Messages:
    855
    Likes Received:
    0
    Thank you, Rex, that's probably where I got that (mis)impression. I pretty much mostly stopped using the "For" command many years ago and now use the "Do" command whenever possible because I just really don't like the "For" command's syntax (the "Do (...)" bit) and I also don't like the fact that the contents of the "For" loop essentially show up as one big, long, continuous line with "Echo On" that really isn't even "traced"; and in those few cases where I actually do use it (more on that in just a moment) I invariably put a Gosub in and as the only contents of the loop. (Although rarely there is test for some variable set by the subroutine followed immediately by a "Leave" right after the "Gosub".) And I do use "For" not-counted loop variations ("For %F in (...)" variation for example); in those situations its "wonderfulness" exceeds its ugliness, but that really doesn't come up all that often for me.
     

Share This Page