-
Content Count
407 -
Joined
-
Last visited
-
Days Won
8
Everything posted by Kryvich
-
So how you like a syntax Embarcadero finally choose for initialization / finalization of the custom managed records? type TMyRecord = record Value: Integer; class operator Initialize (out Dest: TMyRecord); class operator Finalize(var Dest: TMyRecord); class operator Assign (var Dest: TMyRecord; const [ref] Src: TMyRecord); end; Early in 2018 Marco showed a slightly different syntax. I personally would prefer something like type TMyRecord = record Value: Integer; operator Initialize; operator Finalize; operator Assign(const [ref] Src: TMyRecord); end; Then Dest would be replaced by Self.
-
what is the possibility of having a rest/soap webapi in Delphi 2007
Kryvich replied to Ugochukwu Mmaduekwe's topic in Network, Cloud and Web
It's unfair to compare the ancient Delphi 2007 with the relatively new VS 2017. It is not even Unicode compliant. -
Rad Studio has the Migration tool. You can use it to backup & restore registry settings, to migrate to newer version of Delphi.
-
VCL Per Control Styling is planned for 10.4 (https://community.idera.com/developer-tools/b/blog/posts/get-ready-for-the-10-4-beta-with-update-subscription). Perhaps it will help to solve the problem.
-
Why not leave ParentFont property value to default, and modify font settings in Form.OnShow?
-
Boolean evaluation
Kryvich replied to Ole Ekerhovd's topic in Algorithms, Data Structures and Class Design
What is Administrator? Is it a field, or a method (function)? What actual type does this field have? -
I would try to find out when used memory grows in size. After opening a certain form, or after compiling, or after starting the program, or after interrupting of execution Ctrl-F2... Try to temporary disable third party plugins and CodeInsight features (Error insight, Help insight).
-
Final conclusion after setting of UTF-8 as a default code page for Windows: if your program actively uses ANSI strings with national characters, you cannot just recompile the program and hope that it will work correctly. You will have to carefully check the code, and use AnsiStrings with a code page (i.e. AnsiString(1251)) or RawByteStrings where appropriate.
-
@Tommi Prami Just a hope. I haven't access to the 10.4 beta. Note: When UTF-8 is used as a default code page in Windows, if you use national characters in a AnsiChar constant, they should be encoded in #$nn format. Otherwise you'll get "W1061 Narrowing given WideChar constant (#$0401) to AnsiChar lost information". program AnsiCharConst; {$APPTYPE CONSOLE} {$R *.res} const AnsiCharYo1: AnsiChar = 'Ё'; AnsiCharYo2: AnsiChar = #$A8; // 'Ё' in ANSI 1251 Code Page; begin Writeln('#', Byte(AnsiCharYo1), ', #', Byte(AnsiCharYo2)); Readln; end. This program shows: "#129, #168".
-
I think this option is not necessary, if Delphi 10.4 will set UTF-8 encoding by default for all new source files.
-
It's strange that "Borland" still here in Delphi 10.3.3. 🙂
-
I have just write a little command line utility to convert your ANSI file to UTF-8. https://github.com/Kryuski/AnsiToUtf8
-
To support this option, every PAS file in a project should be saved in UTF-8 format (not ANSI!). Otherwise you'll get a bunch of compiler warnings.
-
Never seen this option. Thanks for the heads up. P.S. Is this done to make non-Unicode programs Unicode-compatible? I think Microsoft was late with this solution for 15 years at least.
-
@TomDevOps There have been some corner cases, but I think most of them have already been fixed (for ex. https://quality.embarcadero.com/browse/RSP-23417) or will be fixed in 10.4.
-
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>
-
Is Class with 2 'nested' constructors bad design?
Kryvich replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
While it's OK, I'd suggest to keep constructors as simple as possible. To prevent exceptions while an object is created. -
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
-
mt.Free; mt := TFDMemTable.Create(...);
-
@Georgge Bakh FPC approach isn't wrong, but different. Other Points: Let's experiment: will do the specialization manually as the Wiki suggests. program ClassConstTest2; {$APPTYPE CONSOLE} {$R *.res} type TTest1 = class procedure Test(); end; TTest2 = class(TTest1) procedure Test(); end; TTestTest2 = class FTest: TTest2; procedure TestIt(); end; procedure TTestTest2.TestIt(); begin FTest := TTest2.Create(); FTest.Test(); readln; end; procedure TTest1.Test; begin Writeln('TTest1.Test'); end; procedure TTest2.Test; begin Writeln('TTest2.Test'); end; var Test2: TTestTest2; begin Test2 := TTestTest2.Create; Test2.TestIt; end. This code outputs TTest2.Test
-
@Attila Kovacs Yes, I've found my errors. (Never programmed generics in C# before). Updated code in C#: https://dotnetfiddle.net/010hlp I should say it has absolutely the same behavior as Delphi's one. Perhaps Free Pascal developers understand Generics a little differently.
-
How would you write it in C#? I tried to write it like below, but it doesn't even compile: https://dotnetfiddle.net/OACCH6
-
Unified Memory Management - Coming with 10.4 Beta
Kryvich replied to a topic in Tips / Blogs / Tutorials / Videos
I would like to see in some future version of Delphi: Iif operator - a magic function to write compact and effective statements of any type. Class contracts ("require", "ensure" clauses, https://www.elementscompiler.com/elements/oxygene/language.aspx) Nullable types and ":" operator, https://www.elementscompiler.com/elements/oxygene/language.aspx#colonoperator . "await" and "async" clauses for smooth multithreading. -
If the topic starter get a new license of CE after every incident than OK, it's possible.
-
I have never seen a crash of my 10.3.3 CE. But I program Win 32-bit VCL mostly in it. IDE Fix Pack is installed. It's impossible. 1 year is the maximum license term for CE license.