[lazarus] LCL, general issues

Marc Weustink Marc.Weustink at cuperus.nl
Fri Jun 30 19:21:36 EDT 2000


+ From: Stefan Hille [mailto:stoppok at osibisa.ms.sub.org]
+
+ Hi,
+
+ seems as if I'll have some more time to focus on lazarus the
+ next weeks and thus started to review some of the code already
+ present. Here're some observations:
+
+  - Some source files are messed up with writeln's and assert
+    statements and sometimes contain redundant code. gtkobject.inc
+    is a good example for this and it must be very hard for new
+    developers to understand what's going on. I'd recommend to do
+    a major cleanup. If nobody has anything against it I'll start
+    with this saturday.
+    One question: Few weeks ago there have been some mails
+    about asserst versus writeln. I'd prefer to only use asserts
+    so are there any writeln's that should be protected?

I think we all preferred asserts. The only writelns which should be left
untouched are the ones starting with WARNING: or ERROR:. When everything is
OK you narmally wouldn't see them. They are shown in cases where you as
programmer did something strange (Like the GTK errors)


+  - What kind of strategy shall we use for error-handling?
+    Currently some classes throw exceptions, others use asserts
+    or use default values when something illegal is done
+    (e.g. some index out of range).

This depends on the situation.
You always throw an exeption if you enter a illegal situation (like index
out of range)
Asserts are placed on locations where we as Lazarus developers assume a
certain situation is valid. It is a catch if a developer forgot to do
something to set/call. There is something like this in TControl when setting
a parent. A control cant have istelf (or decendants) as Parent. This is
checked when setteng the parent. Through the rest of the code you can safely
assume that this is the case. However when implementing the Controls unit
you also have direct acces to FParent. You can (illegally) set this whithout
checking. Asserts can pinpoint this so the tracking of bugs are easier.
Use defaults if an illegal input doesn't matter. You can see this in the
WinAPI stuff.

+  - Currently gtk complains a lot about font-stuff and missing
+    pixmaps. Does anybody know the reason?

Yep

+    From my point of view it's very important to fix this
+    because people new to lazarus might get a bad feeling about
+    the project in general.

Its one of my low priority things to fix. As long as Lazarus runs whithout
noticeble problems, they are OK for me. What do you expect for an alpha
state of a project.

+    BTW: Most examples will crash when they are closed. Whats
+    the reason for that? (I can't trace into it because the
+    debugger also hangs when it
pens:-(( 

Hmmm.... Some weeks ago I applied some patches from Vincent which fixed most of them. Have to recheck this.

 
+  - Currently we use lot's of casts and if-statements to determine the
+    componentstyle for different classes. The reason for this 
+    is that the fcomponentstyle member is not in a a common baseclass 
+    (TComponent could be a good choice but it's in fcl). 
+    Should we introduce a new class (derived from TComponent) which 
+    contains fcomponentstyle and will be the base for all lcl classes?

Nope, IMO FComponentStyle is a temporary issue. In a later stage I see it created through RegisterClass, CreateWindow and CreateParams. 

+    (This class could possibly also get the members "Fenabled" and 
+    "Handle" but I'm not absolutely sure about that right now)

These are in the previous case not handled anymore by GTKObject.

Marc






More information about the Lazarus mailing list