Got some time on my hands thanks to the coronapocalypse. I use Lazarus/Free Pascal a lot for personal work, mostly Windows, which is well supported, but Linux support is a bit sketchier, with no native threading and kind of obsolete toolkit bindings (missing good GTK3, for instance.). Thought I might try to get some native threading implemented. Anyone have thoughts on this, know of other attempts, what challenges it faces, why it might be a bad idea? I haven't poked through the source code recently, but IIRC there's a global record with multitasking primitives to be assigned. I would also like to put some coroutine primitives in there, since I got them working fine in Windows. Thoughts
Phrygue
u/Phrygue
33
Got a couple of little Pascal/Lazarus tricks I use, thought I'd share.
First, in a form's declaration, I put:
TMainForm = class(TForm) {%region -fold}
... // autogenerated content
{%endregion}
private
... // regular fields/methods
This automatically hides the form editor generated content without interfering with the generation, greatly cleaning things up. Make sure your {%region} fold setting is set to Fold.
Second, overload the operator "in":
operator in(const index, count: integer): boolean; inline;
begin
Result := (index >= 0) and (index < count)
end;
This lets you to a handy bounds check thusly:
if Index in Count
101
You've reached the end of this feed.