Comments below. -- Bhaskar
> -----Original Message----- > From: [EMAIL PROTECTED] on behalf of Maury Pepper > Sent: Tue 12/6/2005 3:56 PM > To: hardhats-members@lists.sourceforge.net > Cc: > Subject: Re: [Hardhats-members] Linking to VistA > ----- Original Message ----- > From: "Gregory Woodhouse" <[EMAIL PROTECTED]> > Sent: Tuesday, December 06, 2005 2:05 PM > Subject: Re: [Hardhats-members] Linking to VistA > > > > There is a difference, though. In Java, you don't have anything like > > an XECUTE command, so the code to be compiled isn't code "built" on > > the fly -- or am I missing something? > > You're absolutely correct. > > > Of course, when the code to be > > compiled exists in the form of strings it's not so bad, but the D @ > > (...) notation adds another wrinkle. The dynamic code can actually be > > spliced together out of bits of static code (does it need to be > > recompiled?) and dynamic fragments. I don't know the answer. I've > > been trying to think this through ever since Kevin posted his > > original question. > > Bhaskar might clarify what GT.M does for indirection, but recompiling would > not _always_ be necessary. In the case of a DO or GOTO, it might. If the > executable does not keep a table of entry points, then compling and linking > would seem to be required. [KSB] You are correct in that this applies to indirection as well as strings to be Xecuted. As I noted elsewhere, GT.M will compile only if it doesn't already have a cached copy of generated code for that string / indirect reference. > > > There is a cache of a certain number of such code fragments, and > > > the code to be executed is checked against the code fragments in > > > the cache to see whether a compiled version exists. > > > > That's an interesting idea. Something like an instruction cache > > implemented in software? Or are you referring to the hardware > > instruction cache? > > It's a cache in memory -- very common with Mplementation at least since > DataTree started it back in the 80's. [KSB] Out of curiosity, I wonder which came first, GT.M or DTM... > > > Code written in other languages can freely call routines written in > > > GT.M and vice versa (the call-in and call-out interface is the C > > > interface, so this is a requirement of other languages). In fact, > > > the top level program can be a C main() routine; it does not have > > > to be M. However, from C, you cannot directly Xecute a line of M > > > code - you must pass a string with a line of code to an M routine, > > > and it can Xecute it. [Was this your real question?] > > > > I guess I'm trying to figure out what this means. It sounds like > > you're saying that there is a GTM runtime that needs to be invoked to > > handle this sort of task. By way of contrast, I know of at lest a > > couple of compilers for functional languages that work by compiling > > the code to C and then using gcc. Obviously, C requires runtime > > support, too, but maintaining an M environment would be a bit tricky > > (or so I would think). > > GT.M can be linked with object code from any language that supports the C > interface. If by "this sort of task" you mean doing the equivalent of > Xecute, then no, there is no GT.M runtime. You would call an M routine and > pass it the string to be executed. It would be up to the M code to decide > what to do with the string passed in. [KSB] Correct - the M runtime is accessed from M code rather than C code.
<<winmail.dat>>