// HACKER NEWS — CYBERSECURITY
Modern Object Pascal Introduction for Programmers – Castle Game Engine
E.g. FPC allows other file extensions for units. And some people use .pp for unit files, like myunit.pp.
Using a different case is also possible. On Windows file systems, the letter case doesn’t matter. But on Unix file systems is does matter and FPC allows only to use the exact same case as was specified in Pascal uses clause (so MyUnit.pas) or all lowercase (so myunit.pas). Since Pascal is case-insensitive, the first rule sometimes causes issues when people specify unit names with different case in different places.
All in all, we recommend the simple above rule all lowercase, .pas extension for your projects. This matches the most common established practices and works with all compilers and file systems without issues.
This trick (officially allowing the method to be used with Self equal nil) is possible only in non-virtual methods.
In the implementation of such method, as long as Self = nil is possible, the method cannot call any virtual methods or access any fields, as these would cause Access Violation (Segmentation Fault) error when called on a nil instance. See the sample code method_with_self_nil.dpr.
We discourage from using this trick in your own code (for virtual or non-virtual methods) as it is counter-intuitive to normal usage. In general all instance methods should be able to assume that they work on valid (non-nil) instance and can access fields and call any other methods (virtual or not).
This information about destructors is, indeed, inconsistent with the constructors.
It’s normal that a class has multiple constructors. Usually they are all called Create, and only have different parameters, but it’s also OK to invent other names for constructors.
Also, the Create constructor in the TObject is not virtual, so you do not mark it with override in the descendants.
This all gives you a bit of extra flexibility when defining constructors. It is often not necessary to make them virtual, so by default you’re not forced to do it.