Thank you, Tomas, those are all excellent suggestions! I am glad I asked. On Sun 18 Dec 2011, Tomas Hajny wrote: > On 17 Dec 11, at 21:07, David Emerson wrote: > > > two little questions > > > > 1. Is it possible to make an alias to a function ... so rather than just > > re-calling with the same parameters, it's actually the same thing? like the way > > we can do, e.g., type natural = cardinal, or const GG = 6, but with a function? > . > . > > There are multiple solutions possible: > > 1) Making the functions public and creating the aliases as external: > > procedure X; public name 'X'; > begin > WriteLn (1); > end; > > procedure Y; external name 'X'; > > begin > X; > Y; > end. > > > 2) Using procedural variables / constants: > > type > TProc = procedure; > > procedure X; > begin > WriteLn (1); > end; > > const > Y: TProc = @X; > > begin > X; > Y; > end. > > > 3) Using inlining: > > procedure X; > begin > WriteLn (1); > end; > > procedure Y; inline; > begin > X; > end; > > begin > X; > Y; > end. > > Tomas > > _______________________________________________ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > http://lists.freepascal.org/mailman/listinfo/fpc-pascal >
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal