Advertisement
filhotecmail

Maybe<T> ObjPascal

Aug 29th, 2020
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. type
  2. IMaybe<T> = Interface
  3. ['{1E034B6C-6CAF-4825-A147-2306393B9056}']
  4. function NullValue:Any; overload;
  5. function Value: T; overload;
  6. function Value(Arg: TProc<T,Any>): T; overload;
  7. End;
  8.  
  9. Type
  10. TMaybe<T: constructor> = Class(TInterfacedObject,IMaybe<T>)
  11.  
  12. private
  13. {Private declaration}
  14. var FValue: Any;
  15. FNullValue: Variant;
  16. function ObjisNull:Any; virtual; Abstract;
  17. protected
  18. {Protected declaration}
  19. function ContractsRequired:Any;
  20. function TryGetValue:T;
  21. public
  22. {Public declaration declaration}
  23. class function New(Arg: T ): T;
  24. End;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement