Done Multi-line in-memory functions

Oct 18, 2009
Copied from an off-topic comment regarding adding a library command.

I would like to see something like BASH has, that is, the .bashrc file is loaded upon startup. The .bashrc file can contain multi-line functions, which would stay in memory like TCC plugins do.

Or, like the Powershell Microsoft.PowerShell_profile.ps1 file, which does the same thing as .bashrc does.

Ref: BASH Startup Scripts


#7 Joe Caverly, Yesterday at 6:07 AM
Oct 18, 2009
4Start/TCStart cannot have multiple-line functions. For example, in my PowerShell Profile I have;

function Get-ProgID
  param ($filter = '.')

  $ClsIdPath = "REGISTRY::HKey_Classes_root\clsid\*\progid"
  dir $ClsIdPath |
   foreach {if ($ -match '\\ProgID$') { $_.GetValue("") }} |
     where {$_ -match $filter}

Get-ProgID is now a function that I can call from the command line. Example;

Get-ProgID VBScript

#9 Joe Caverly, Yesterday at 11:16 AM
Oct 18, 2009
I see two separate issues:

1) TCC subroutines can return a value, so they can perform as functions.

A function could be defined that calls a multi-line subroutine in a .btm and returns the value returned by that subroutine.

2) That still requires repeatedly accessing a routine on disk.

Keeping a multi-line function in memory would basically be equivalent to keeping a subroutine or an entire .btm in memory.
If BASH and PowerShell can define multi-line functions in their startup files, and then keep them in memory, this should be possible with TCC.

Rule of thumb:
Your decision to load something as a function is also going to depend on how often you use it. If you use a small shell script infrequently, leave it as a shell script. If you use it often, turn it into a function.

Ref: Functions, Aliases, and the Environment

Oct 18, 2009
It certainly could be done. The question is whether Rex wants to add it. I get the impression it would require some major reworking.

Another consideration is the increasing use of SSD's. I realize that TCC tends to be used on servers and those tend to still use hard disks. Also, although SSD's can have read/write speeds in the range of 500MB/s, memory access (e.g., ramdisk) can easily be 4-6GB/s. And my understanding is that on its own Windows will cache in memory relatively small files that are accessed frequently.

But I think in most cases people would be fine with "repeated disk acccess" at 500MB/s. So a question is whether Rex wants to make a major change that will probably be almost moot in a few years.
Similar threads
Thread starter Title Forum Replies Date
R Done Add Libraries and Multi-line In-Memory functions to Features List on Website Suggestions 1
x13 Declined Multi-line FUNCTIONs Suggestions 14
vefatica Declined Multi-line UDFs Suggestions 11
Roedy Done multi-job access Suggestions 4
vefatica File name completion at the beginning of the command line Suggestions 6
D Done BDEBUGGER: add cmdline option to set a breakpoint at a given line Suggestions 0
D Done TCEdit and BDEBUGGER: add cmdline switch to jump to given line Suggestions 2
vefatica Done DIR /P ... scroll by one line Suggestions 4
R ffind /= and command line Suggestions 0
R Done Command History Window: select more than one line. Suggestions 0
Charles Dye Done TCEDIT: Command-line option to print files Suggestions 2
vefatica Declined @@key alias at beginning of partial command line Suggestions 10
M Declined Command line support for Virustotal Suggestions 0
rconn Command Line constructor custom DIALOGs for batch files Suggestions 0
rconn A Command-line comparison Suggestions 0
rconn Done database access from command line Suggestions 0
rconn Declined Execute a screen line Suggestions 0
K_Meinhard Done Mutiple-line comamnd line input? Suggestions 5
Peter Bratton Done Keep IDE active line centered Suggestions 0
J Done program elevation from command line Suggestions 0
W Done Add an option to control command line parsing Suggestions 7
Gisle Vanem How to? Accessing alias shared memory Suggestions 4
S Declined MEMORY and environment Suggestions 3

Similar threads