[fpc-devel]Some crazy ideas

Pavel V. Ozerski pavel at insect.mail.iephb.ru
Wed Feb 6 12:38:44 CET 2002


Hello all,

Athough I don't introduce new features to FPC now (I hope, only
temporarily: while I have some important work which is not
FPC-related) an only sent two incompatibities reports (sorry, after
changing of my E-Mail client I forgot to translate my name in it from
cyrillic to latin ABC immediately) but in between times I accumulated
some crazy ideas which, I hope, could be interestnig.

Idea (1): Possible full Unicode support.
Now in FPC exists objpas module which does redeclare some types and
functions fir $objfpc and $delphi modes. But similarly a UniFpc module
could be introduced which must:
1) redeclare char, pchar, string to wide;
2) owerwrite some RTL functions (write, str, val etc) to support
Unicode by default;
I see some problems here, to be frankly:
1) UniFpc should be separate for every target because it must use
OS-depended API;
2) Because FPC must be also cross-compiler, converting ANSI to unicode
cannot use direct calling of OS API conversation functions because
Unicode is different in different operating systems; compiler should use
internal tables to recoding;
2) at least one additional complier directive should be used:
{$charset unicode,nnnn|$charset ansi}

Idea (2): possible way to support public inline procedures/functions
and some possible consequences

Here I would explain full way of my reflections.
If we will use inline procedure which is written in one unit, in other
units, we cannot save it as compiled machine code (because otherwise
then we need to disassemble it before use). Then I
make a conclusion: code of inline procedure must be stored into ppu
file. But as what? At first look, storing it as a sequence of assember
instructions seems to be a good idea. But really this way could cause
some problems, mainly in optimization quality. For optimizer that
could be not indifferent, is a parameter got by inline function a
constant, a memory-stored or a register-stored variable. Therefore,
maybe, that would be better, to save inline procedure in ppu-file as a
sequence of TOKENS (may be, partially optimized).

But then for us some new possibities will be available, if we will
store some parts of code not fully compiled (for releasing at
including into "pseudo-caller" stage). Then become to be not meanless
declarations like

procedure TheProc(type UserType, var x:inline; y:inline);inline;
 begin
  x:=x+UserType(y);
 end;
.....
TheProc(integer, AnIntegerVariable,'A');
TheProc(shortstring,AStringVariable,'B');

Furthermore, this way could help to make in FreePascal full support of
class templates, like C++!

Sincerly, Pavel







More information about the fpc-devel mailing list