Jump to content
Kryvich

Overstatic methods

Recommended Posts

In Delphi 10.3.3 it's possible to write:

  TStaticCheck = class
    class procedure OverStatic; static; static; static; static;
  end;

I don’t know, is it worth reporting to the issue tracker?

The idea is taken from here: System.Generics.Collections.pas, TArray.BinarySearch<T>

  • Haha 1

Share this post


Link to post

Overstatic methods cannot be moved to another class.

Overstatic methods cannot be modified, only deleted completely.

Add "static; static;" to a method to protect your class from coronavirus.

 

P.S. In .NET it is considered an error. https://dotnetfiddle.net/dv8Rfh

Edited by Kryvich

Share this post


Link to post

For what it's worth, going by the little I know about parsers, I guess the parser just takes any list of modifiers after the method signature, and sets the flags on the method. I guess "static" doesn't throw an error if the "static" internal flag was already set, so I agree it's quite harmless.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×