On 19.11.2011 17:19, John Lee wrote:
Surprised this capability hasn't come up before because
doesn't sound technically difficult to do.
Free Pascal is a static language, as Bernd already wrote and as such the
compiler is geared towards this fact. So what you suggest would mean to
rewrite larg
2011/11/19 John Lee :
> Surprised this capability hasn't come up before because doesn't
> sound technically difficult to do.
The problem is simply that at the time of compiling the unit all the
function calls within it are already statically resolved and
everything is cast in concrete. Pascal is a
On 11/19/11 11:19 AM, John Lee wrote:
> Surprised this capability hasn't come up before because doesn't sound
> technically difficult to do.
The need for this capability HAS come up before. That's why the methods
that are available are available. They may appear to be "too
complicated" but it
Thanks for the feedback & suggestions - looks like either functions as
parameters or using objects are only ways to do this - either makes the
code look horrible & more complex that necessary imo cf the normal use of
functions. Surprised this capability hasn't come up before because doesn't
sound t
On 11/18/11, Sven Barth wrote:
> But he wants to call "fnb" in the main program and have that call "fna"
> of the main program instead of "fna" from "jim".
You're right.
I misread the original post.
Bart
___
fpc-pascal maillist - fpc-pascal@lists.fr
2011/11/18 John Lee :
> Never seen this before - is there a way I can force fnb to use the main
> program's version of fna, not the version that's in the unit?
> TIA John
Your problem sounds very much like you would really want to make use
of objects, inheritance and virtual methods. Instead of pa
On 18.11.2011 18:15, Bart wrote:
{file: prog.pas}
Program Prog;
{$ifdef fpc}
{$mode objfpc}{h+}
{$endif}
uses jim;
function fna: string;
begin
fna := 'Prog';
end;
begin
writeln('fna = ',fna);
writeln('jim.fna = ,'jim.fna);
end.
Compiled with both TurboPascal 6.0 and fpc 2.4.4. the
Thanks for the fix, but it makes the code a bit more complicated than
I'd hoped/thought based on my (over simple?) impression that local fns
are used in place of those in units. John
this would be true if you declared another function fnb locally, so that
calling fnb could eventually override t
{file: jim.pas}
unit jim;
{$ifdef fpc}
{$mode objfpc}{h+}
{$endif}
interface
function fna: string;
function fnb: string;
implementation
function fna: string;
begin
fna := 'jim';
end;
function fnb: string;
begin
fnb := fna;
end;
end.
{file: prog.pas}
Program Prog;
{$ifdef fpc}
{$mod
Thanks for the fix, but it makes the code a bit more complicated than I'd
hoped/thought based on my (over simple?) impression that local fns are used
in place of those in units. John
On 18 November 2011 16:55, Sven Barth wrote:
> Am 18.11.2011 17:47, schrieb John Lee:
>
> Sorry for confusion, m
Am 18.11.2011 17:47, schrieb John Lee:
Sorry for confusion, my email wasn't clear...
old fpc version, that I have to use because of availability of various
units...Free Pascal Compiler version 2.2.2 [2008/08/03] for i386
this is jim.pp---
unit jim;
interface
function fna:string;
function fnb
Sorry for confusion, my email wasn't clear...
old fpc version, that I have to use because of availability of various
units...Free Pascal Compiler version 2.2.2 [2008/08/03] for i386
this is jim.pp---
unit jim;
interface
function fna:string;
function fnb:string;
implementation
function fna:strin
Am 18.11.2011 16:49, schrieb John Lee:
I have a normal fpc unit, call it jim, with 2 functions fna & fnb . fnb
uses internally fna.
My main program, has a uses clause including jim, and also a _different_
version of fna, with same parameters as for that in jim, but no fnb.
The problem I get is
Am 18.11.2011 16:49, schrieb John Lee:
I have a normal fpc unit, call it jim, with 2 functions fna & fnb . fnb
uses internally fna.
My main program, has a uses clause including jim, and also a _different_
version of fna, with same parameters as for that in jim, but no fnb.
The problem I get is
14 matches
Mail list logo