Jump to content

Emil Mustea

Members
  • Content Count

    9
  • Joined

  • Last visited

  • Days Won

    1

Emil Mustea last won the day on December 9 2018

Emil Mustea had the most liked content!

Community Reputation

5 Neutral

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. quick search: https://www.secureblackbox.com/kb/help/ref_howto_pdf_sign_sign.html https://www.gnostice.com/nl_article.asp?id=187&t=How_To_Digitally_Sign_A_PDF_Document_In_Delphi http://www.tmssoftware.biz/flexcel/doc/vcl/samples/delphi/printing-and-exporting/signing-pdfs/index.html I didn't try any of this.
  2. To summarize: Who wants maximum performance like "classic" use it like this var obj := Shared.Make(TTestObj.Create)(); "obj" is object and will be free it at the end of the procedure; otherwise, use it: var obj := Shared.Make(TTestObj.Create); "obj" is interface and will be free it at the end of the block and every access has a small penalty of an anonymous method call.
  3. instead of writing s.Value.Add('one'), you write s.Add('one'), where "s" is a record but point to the only member of that record, which is in our case a TStringList. So you have member lifting.
  4. 1. I get to used with inline declaration 🙂 2. You wrote "instance of a record" - in this case we need member lifting. If TAutoFreeRecord returns generic type of that parameter, then it's like the example I gave.
  5. I think if we use copy constructor we can create smart pointers like this: procedure DoSomething(OtherParameters: string; New: TAutoFreeRecord); //here "New" record is created by copy constructor var s: TStrings; begin s := New.Of(TStringList.Create); s.Add('one'); s.Add('two'); //here "New" goes out of scope and will destroy "s" (custom destructor) end; or with inline declaration: procedure DoSomething(OtherParameters: string; New: TAutoFreeRecord); //here "New" record is created by copy constructor begin s := New.Of(TStringList.Create); s.Add('one'); s.Add('two'); //here "New" goes out of scope and will destroy "s" (custom destructor) end; It was very nice if managed records in 10.3 had member lifting. In that way we could escape declaring "New"; New.Of will return instead a record which the only member could be lifted and used as a TStrings.
  6. Emil Mustea

    Directions for ARC Memory Management

    Yes, you are right, we still need member lifting. Until then, the nicest remains Interface use like Primož said: uses Spring; var ms := Shared.New(TStringList.Create); ...
  7. Emil Mustea

    Directions for ARC Memory Management

    Sorry, it's my mistake. I forgot the "var": (inline declaration with type inference) begin var sl := New.Of(TStringList.Create); sl.Add("One"); sl.Add("Two"); //here the record "New" goes out of scope, runs the it's destructor which will free the instance on which "sl" points to end; Better: with inline declaration will stay alive until the block end, not until routine end.
  8. Emil Mustea

    Directions for ARC Memory Management

    quote from: http://blog.marcocantu.com/blog/2018-october-Delphi-ARC-directions.html If "managed records" from 10.3 have destructor like I understand, there is no need for default property/member lifting. Will be possible super cool (and readable) construct like this: begin sl := New.Of(TStringList.Create); sl.Add("One"); sl.Add("Two"); //here the record "New" goes out of scope, runs the it's destructor which will free the instance on which "sl" points to end; I hope I'm not missing something. Mr. Marco Cantu, can you confirm the "managed records" from 10.3 have destructor?
  9. Emil Mustea

    Directions for ARC Memory Management

    The quote is from: https://delphisorcery.blogspot.com/2015/01/smart-pointers-in-delphi.html Can somebody confirm that the "new" record type will have a default property? so will not have to write .Value in smart pointers. Indeed this will be really cool and really useful as automatic memory management: var s: Shared<TStrings>; begin s := TStringList.Create; s.Add('one'); s.Add('two'); //here "s" will be realeased automatically because is a record end;
×