Version 28 LIBRARY changes have side effects

Apr 13, 2010
314
7
61
The Hague
/R has been modified to qualify function names with the name of the library.
/F now lists the functions with their qualified names.

If you have a cycle where you compose your library with several source files expecting to write them out again to a single file, that file is now unusable as a source file. Upon rereading the single file the library functions are doubly qualified.

This is quite usefull when managing SETtings, aliases and functions.

Could /N be redefined as
/R /N - do not qualify added / updated functions
/F /N - remove library names from the functions listed?

Regards, DJ
 

rconn

Administrator
Staff member
May 14, 2008
12,404
152
I don't understand what you're trying to do -- generate a library containing libraries?

How are you combining your multiple library files into a single file?

/R /N wouldn't work, as ALL functions are now required to have library names added when they're loaded in order for LIBRARY to find & execute them.

/F /N could be done, but seems pointless.
 
Apr 13, 2010
314
7
61
The Hague
In short, I restore my general environment by restoring frozen states per list-type (envars, aliases, functions and library functions and others). Much faster and simpler startup code. The frozen states are generated by separate source files that only update the f-states when changes to the source are detected.

And yes, I use

Code:
:: Creating a frozen state, only rarely.
set envar1=value1
set envar2=value2
...
set * >! set_of_values.SAVED

:: Reusing it frequently.
set /R set_of_values.SAVED

I have the same setup for aliases and functions.
Through the years my source files have grown considerably and contain a wealth of information about the history of its contents. When was what changed into what and for what reason.

It has allowed me to create general purpose environments with application- and hardware-specific specializations that are easy to track, maintain and communicate to end-users.

I understand that by qualifying the library functions with their filename you are trying to prevent name-collisions. I pointed out that your chosen design, contrary to the case of envars, aliases and functions, breaks the expectation of reusability by modifying the original content. Now, LIBRARY * >! set_of_functions.SAVED is useless.

My request is, that you restore the reusability of the output, by whatever option of your choosing.

And, now that we are on this topic, another surprising design choice comes to mind. It seems that upon reading the source with LIBRARY /R you also remove leading whitespace. I understand that it reduces size a little and is slightly speeds up the interpreter but, why would you not remove comments, then?

It took me a couple of minutes to come up with a perl script that does the trick:
Perl:
use strict;
use warnings;

while (<>) {
    # Skip comment blocks
    next if /COMMENT/../ENDCOMMENT/;
    # Remove Leading whitespace
    s/^\s+//;
    # Remove single line comments
    s/^(::|rem).*$//;
    # Skip white lines
    next if m/^\s*$/;
    print;
}

#EOF
However trying to duplicate this using TPIPE has me stumped, even after hours of trying.

I'll be interrested in hearing your thoughts.

Regards, Dirk Jan.
 

rconn

Administrator
Staff member
May 14, 2008
12,404
152
There seems to be a common misconception that libraries are like aliases or functions that support multiple lines. In fact, they have nothing whatever in common, and share 0% code. Libraries are actually like little batch files that live in memory all the time; this is what allows the debugger to step through them. (Something that cannot be done with aliases or user-defined functions.)

What you're doing is the opposite of the way I intended to have libraries work, and doesn't make any more sense to me than having all of your batch files saved as one gigantic batch file. And it would make it pretty much impossible to have third-party library files as there would be endless name conflicts. It also would mean LIBRARY /R could only read a single file.

However -- I made a change in LIBRARY /R for the next build that looks to see if the function name already contains a '$'; if so it won't add another one (filename$function). This will allow you to use your single saved library file. Not supported and definitely not recommended, but it should work for you.

Libraries strip whitespace, blank lines, and comments outside of function declarations; comments inside the function are maintained (by user request) so they will be visible in the batch debugger.
 
Similar threads
Thread starter Title Forum Replies Date
Dmitry L. Kobyakov How to? How to remove the record of the old version of the Take Command? Support 9
D Documentation WebHelp lands at version 26 Support 4
fishman@panix.com HELP!! I just updated to Version 28 and as usual I cannot make extended directory search work. Support 2
T Take Command 28: Lua reports version 5.4.0 (5.4.3 expected) [SOLVED] Support 1
S Issues with version v26.02.42 x64 Support 0
Joe Caverly Documentation COMMANDS in Version 27 help Support 8
C version help Support 3
R Inconsistency in @version's use of quotes Support 2
thorntonpg What is the latest version of everything Support 1
S Windows Server version not being detected correctly in TCMD 26RC2 Support 9
D Which is the latest version for Windows XP? Support 2
gentzel "Check for Updates" appears to be checking for old version Support 2
D Fixed @VERSION does not increment pre-fixed version numbers. Support 1
nikbackm TCMD 25 - Unregister older TCMD version Support 2
Stefan Hassel Installation file TC 24.02 Build 47 is actually version 25.00.1 Support 10
Joe Caverly What version and Windows OS are you using? Support 3
Dmitry L. Kobyakov From old version: had the setup's error been corrected? Support 6
R How to? Compare executables' version/build # including 123.456.789.01 Support 10
RChrismon How to? Copy TCMD.INI to New Version Support 7
vefatica Windows 10 version number? Support 6
H @ceiling @floor @int not working version 21.01.63 Support 9
B Everything version in Take Command build 39? Support 3
G Version 20.11 installed on Windows 10 problems Support 9
M ANSI is used to show files instead of OEM in version 17 to 19 ! Support 5
E How to? Create a portable version of TCMD to use on other computers w/o installation Support 4
C 21b47 version[] Support 4
fishman@panix.com Version 21.23 fails to install Support 4
E Fixed View command broken in version 21.0 build 22 Support 9
rconn News Take Command + TCC + TCC-RT Version 21 Public Beta (RC1) Support 0
R How to? Not have RT version show on start Support 3
Roedy WAD Version number Support 1
Craig Fitzgerald problem with executable extensons with TCC version 19.10.51 x64 Support 3
Jesse Heines How to? Everything Tool Not Working After Version 20 Installation Support 8
T Portable instructions for version 19 Support 7
cgunhouse Version 19.00.23 Crashes Support 16
vefatica Updater says wrong version Support 1
Sande Nissen TCC/LE version? Support 6
Mordachai Upgrades - can I skip version(s)? Support 2
D Version 18 changed the naming convention of TC's folder Support 5
D Started suggestions, not in this version (yet?) Support 1
fishman@panix.com How about updating the version shown when you upload a new one? Support 4
Joe Caverly PLUGINs and Version 17.0 Support 4
C Is 17.00.55 same as release version? Support 3
Jay Sage Version 17 Installer Leaves Multiple Copies of ShrAlias Support 48
M How to? Start the version of Take Command that I want... Support 7
B Help file problem with version 16 Support 2
T "Checking for a newer version" doesn't complete Support 18
Dan Glynhampton Fixed @version "force" flag not working, and unable to set separator Support 3
J Required version for Windows 8.1? Support 2
L Windows 8.1 version display Support 5

Similar threads