Ok so not possible...(about other languages, yes, and this works when operators are implemented as members functions, with the Pascal operator overloading syntax you see the limit: it's just impossible to specify a type as parameter !!)
But it is possible... as long the type is a class you can specify it as a class reference....
Example:
program untitled;
{$ifdef fpc}{$mode delphi}{$H+}{$endif}
type
TMyClass = class
class function test(i: integer): boolean; static;
end;
TMyClassRef = class of TMyClass;
class function TMyClass.test(i: integer): boolean; static;
begin
result := true;
writeln(i);
end;
procedure testme(a:TMyClassRef);
begin
a.test(100);
end;
begin
testme(TmyClass); //prints 100 ;)
end.
Note that in other languages that is about the same. E.g. that it works in Java is because there everything is an object (class), even simple types.
So nothing is missing. Even if you would need reflection you can use RTTI. (which is about the same as in Java too)
If you need it, then box your type into a class....If it isn't a class yet
Your example adapted:
program Project1;
{$Mode objfpc}
{$Assertions+}
type
TFoo = class
class function test(i: integer): boolean; static;
end;
TFooRef = class of TFoo;
class function TFoo.test(i: integer): boolean; static;
begin
Result := true;
end;
operator in(Lhs: integer; const Rhs: TFooRef): boolean;
begin
Result := Rhs.test(Lhs);
end;
begin
assert(TFoo.test(42));
assert(42 in TFoo);
end.
So, yes, it is definitely possible to specify a type as parameter!! As long as it's a class...
I am rather pleased with that example