[fpc-devel]feature requests: circular unit ref, usage before define, Delphi constructs, block local identifiers
R Hof
rh_rules at yahoo.com
Mon Mar 25 13:29:33 CET 2002
I've got some things I like to see implemented in free
pascal.
The first thing is the possibility to let units
include eachother. This is rather useful to code in a
structured way in oop. For example suppose there's a
class TMain, which has a child of type TChild. Of
course this child wants to know its parent by its type
and the other way round. I want to split up my code so
that the units don't become too big, so child and
parent are declared in different units. So the
situation is as follows:
{ t1.pas }
unit t1;
uses t2;
interface
type
TMain = class
Child: TChild;
.
end;
implementation
.
end.
{ t2.pas }
uses t1;
interface
type
TChild = class
constructor Create(owner: TMain);
.
end;
implementation
.
end.
Compiling t1.pas yields a circular unit reference
error. A solution is typecasting, but isn't very nice.
The real solution is to allow circular unit references
in unit interfaces as well.
------------------------
The second feature request is the usage of identifiers
while they're defined later on in the code. For
example, sometimes is looks more natural if some
procedure is defined before another one. Defining
procedures forward is a solution, but it would be
easier if this wouldn't be necessary.
------------------------
Third:
- dynamic arrays (var a: array of integer;)
- Variants
- out arguments (ie procedure p(out a: integer); )
like in Delphi
Fourth:
block local identifiers:
- if (...) then begin
var i: integer;
.
end;
- 1) "with x := a[i].position.x do ..."
or better: defining identifier x at the same time
like
2) "with var x := a[i].position.x do ..."
or
3) "with const x: integer = a[i].position.x do ..."
I'd prefer construct 2) (so without mentioning x's
type explicitly). Construct 1) where x
is defined as a local variable elsewhere can also be
useful.
(Note: replies please to rh_rules at yahoo.com, I'm not
in the mailing list(s))
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
More information about the fpc-devel
mailing list