<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
29.01.2011 19:25, Sven Barth wrote:
<blockquote cite="mid:4D44072B.1040903@googlemail.com" type="cite">Does
someone know a good place to link this page from? Maybe something
where other language/compiler features are referenced from or can
be linked to in the future.
<br>
</blockquote>
<a
href="http://wiki.freepascal.org/delphi_language_features_which_fpc_does_not_have">http://wiki.freepascal.org/delphi_language_features_which_fpc_does_not_have</a><br>
<a href="http://wiki.freepascal.org/FPC_New_Features_Trunk">http://wiki.freepascal.org/FPC_New_Features_Trunk</a><br>
<blockquote cite="mid:4D44072B.1040903@googlemail.com" type="cite">
* I have yet to test whether the restriction "Create must be first
statement in constructors" holds true (I've found a code sample
that suggests its not true)
<br>
</blockquote>
"<span class="Apple-style-span" style="border-collapse: separate;
color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-style:
normal; font-variant: normal; font-weight: normal; letter-spacing:
normal; line-height: normal; orphans: 2; text-indent: 0px;
text-transform: none; white-space: normal; widows: 2;
word-spacing: 0px; font-size: medium;"><span
class="Apple-style-span" style="color: rgb(17, 17, 17);
font-family: sans-serif; font-size: 15px; line-height: 22px;
text-align: left;">If a class helper has a constructor the first
statement in that constructor must be a call to the
parameterless constructor." I think this is a copy-paste from
some delphi .net or c# help where "</span></span><span
class="Apple-style-span" style="border-collapse: separate; color:
rgb(0, 0, 0); font-family: 'Times New Roman'; font-style: normal;
font-variant: normal; font-weight: normal; letter-spacing: normal;
line-height: normal; orphans: 2; text-indent: 0px; text-transform:
none; white-space: normal; widows: 2; word-spacing: 0px;
font-size: medium;"><span class="Apple-style-span" style="color:
rgb(17, 17, 17); font-family: sans-serif; font-size: 15px;
line-height: 22px; text-align: left;">parameterless constructor"
has some special meaning. <br>
</span></span><br>
<blockquote cite="mid:4D44072B.1040903@googlemail.com" type="cite">
Regarding the algorithm I use to find the last available class
helper (this is implemented in
compiler/symtable.pas/search_last_objectpascal_classhelper):
<br>
Delphi uses the last class helper that is available in the current
scope for method resolution (and the "parents" of that class
helper). For this I walk the symtable stack and search for a def
where is_objectpascal_classhelper returns "true". This can
potentially lead to a bad runtime behavior if a project does not
use any class helpers, but includes many units (the compiler is a
good example of that).
<br>
Do you (especially @Devs) think that this is a sufficient approach
or should this be done another way? (Note: I have not yet profiled
compiling the compiler once with that search enabled and once
without)
<br>
</blockquote>
Maybe to speedup the search we can mark the symtable with a flag
that if it contains a class helper? Other flags can come in future -
like has type definitions - to speedup type searches.<br>
<br>
<blockquote cite="mid:4D44072B.1040903@googlemail.com" type="cite">
Perhaps searching for class helpers should be made dependent on a
modeswitch? E.g. "useclasshelpers"
<br>
That might lead to the potentially confusing behavior that a class
helper is not even found in its own unit though, although I think
that this would be a consequent behavior (the switch needs to be
documented good enough though ^^).
<br>
This switch could be enabled by default in mode Delphi.
<br>
</blockquote>
objfpc also allows final methods and sealed classes so it needs
class helpers too. Better to allow them for all modes which support
classes I think.<br>
<br>
Don't forget about record helpers. And I also noticed that in delphi
class helpers and record helpers are synonims so you can define a
class helper for a record and a record helper for a class - I think
FPC should be more restrictive here.<br>
<br>
Best regards,<br>
Paul Ishenin<br>
</body>
</html>