-
Content Count
1085 -
Joined
-
Last visited
-
Days Won
72
Everything posted by pyscripter
-
As per title. In fact P4D added support for python 3.14 back in January, when it was still in alpha stage.
-
Best strategy to set up global Release/DebugDCU paths in the IDE, as example for Spring4D DCUs
pyscripter replied to HaSo4's topic in Delphi IDE and APIs
Not sure how you deduced this. All of my component libraries and many of the third-party ones I use do have $Auto. In fact I posted about it when it was first introduced with a bug which was later fixed. And I agree it is very useful. Again not sure why you say this. You don't have to compile everything every time. Not even when you switch platforms if you set a platform specific DCU output directory. And in any case my 1m line project builds in about 20 seconds. -
Best strategy to set up global Release/DebugDCU paths in the IDE, as example for Spring4D DCUs
pyscripter replied to HaSo4's topic in Delphi IDE and APIs
You don't. MultiIstaller can use existing library source code folders. You only clone git repos once. You then just pull the changes. -
Best strategy to set up global Release/DebugDCU paths in the IDE, as example for Spring4D DCUs
pyscripter replied to HaSo4's topic in Delphi IDE and APIs
It is worth looking at how python manages imports and see whether we can learn something about Delphi. Python installations typically contain hundreds of third party libraries (packages), but the search path (sys.path) contains only a small number of entries. This is achieved by implementing four features: 1. Virtual environments Isolated environments in which you can import dependencies and run python code without affecting other python installations. 2. A standard location for installing third-party libraries This is the lib\site-packages folder. There are two of those, one installation specific and one user specific. 3. Flagging subdirectories as packages (folders containing importable stuff). If a subdirectory contains a file __init.py__ it is considered a package that can be imported. For example, the python path contains a folder lib\site-packages. Say, a subdirectory of site-packages contains a foder called rpyc with a file rpyc\__init__.py. Then rpyc can be imported in python directly without the rpyc folder being in the search path. Packages may contain subpackages which can also be imported, 4. Relative imports A package may use internally other modules (units in delphi) which may be hierarchically structured. Inside the package you can import such modules using a relative import command. The -r Delphi command line flag mentioned above provides a way of emulating virtual environments, but it is quite laborious to use. Also Delphi does have the syntax: uses FileName in 'relative_path'; But this syntax is strictly reserved for dpr or dpk files. What if that syntax was allowed in units? You could then structure your library hierarchically with only the top level exposed via the library path. Units that are not meant to be imported directly would reside in subfolders that are not visible to users, and used internally with relative imports. Spring4d comes to mind as a library that would benefit from this. What do you think? -
Best strategy to set up global Release/DebugDCU paths in the IDE, as example for Spring4D DCUs
pyscripter replied to HaSo4's topic in Delphi IDE and APIs
What @Anders Melander is advocating is closer to how people work in python. For every project you create a self-contained virtual environment that includes all the dependences. Python has the tools to make this workable and fast. The equivalent in Delphi would be to have for every project a virtual machine with the required version of Delphi installed and just the dependencies you need. But this is not as practical, with Delphi. FWIW, what I do for projects of moderate size (about 1m lines including dependencies) is: Minimize the use of third party tools. For instance, although I know that the Spring4D collections are better than the RTL ones and that there are faster JSON libraries than System.JSON I stick to the RTL libraries. Having said that, PyScripter has 16 external dependencies, many of which I developed or maintain. Only use open source projects with available source code, preferably actively maintained. Try to use the latest versions of all dependencies and Delphi. This sometimes leads to incompatibilities and troubles, but I think that the benefit of getting the latest features and bug fixes outweighs the trouble. My library paths point to the source code (typically in cloned git repos) and not the compiled dcus. I know this will be frowned upon. However, in my case it saves me time. When a dependency gets updated, I just pull the latest updates from the git repo without having to install the components. When I upgrade to a new Delphi version, I use MultiInstaller to install all the dependencies in one step. MultiInstaller can install dependencies from git repos, zip files or existing folders. It can also install components in the 64 bit IDE of Delphi 13. The whole process takes minutes not hours. -
hydrobyte/TestJSON: A simple project to test JSON libraries with Delphi and C++Builder. presents JSON library benchmarks comparing a large number of alternatives. One thing that strikes me, is that the System.JSON rtl library is doing relatively well compared to the competition, both in terms of performance and in terms of JSON validation. With the exception of Find, is very competitive in all other areas. I have seen many claims that System.JSON is very slow and that the xyz library is so many times faster. Do these benchmarks suck (like most benchmarks)? Or is it the case that System.JSON is not that bad? What is your experience?
-
But you are saying that System.JSON in Delphi 12 is 3x faster than in 11. Am I right?
-
@MarceloHByte Incidentally, which version of Delphi did you use for the benchmarks?
-
I was referring to Delphi's System.JSON and why it got faster in v12 vs v11. JSONDataObjects introduced faster checking for duplicates Performance: Use binary search for finding case sensitive names inste… · ahausladen/JsonDataObjects@4680dc9 that explains the improvement. It would be worth submitting an Issue regarding the memory leaks though.
-
The only obvious change in System.Json I noticed between Delphi 11 and 12, is the removal of Range and Overflow checking in some performance critical parts. Surprising it makes such a huge difference (3x faster). This may explain the perception about the slowness of System.JSON when using versions earlier than Delphi 12.
-
Indeed. See also my own translation: https://github.com/pyscripter/SynEdit/blob/27b5d713b4806ccbf38412cd138d8ee7d4ccc499/Source/SynAccessibility.pas#L220 The weird thing is that GetIt includes the "Windows API from WinMD" package that has correct translations of the Automation API and many others. Why Embarcadero did not use these translations escapes me. Please submit a bug report.
-
Date detection algorithm for strings
pyscripter replied to JohnLM's topic in Algorithms, Data Structures and Class Design
You can do it in (at least) three ways: 1. Use AddRawOptions RegEx.AddRawOptions(PCRE_UNGREEDY); With older versions you can use this code (see [RSP-21733] Compile PCRE with JIT enabled - Embarcadero Technologies) {$IF (CompilerVersion <= 35) and not Declared(RTLVersion112)} type TPerlRegExHelper = class helper for TPerlRegEx procedure AddRawOptions(PCREOptions: Integer); end; procedure TPerlRegExHelper.AddRawOptions(PCREOptions: Integer); begin with Self do FPCREOptions := FPCREOptions or PCREOptions; end; type TRegExHelper = record helper for TRegEx public procedure AddRawOptions(PCREOptions: Integer); end; procedure TRegExHelper.AddRawOptions(PCREOptions: Integer); begin with Self do FRegEx.AddRawOptions(PCREOptions); end; {$ENDIF} 2. Another use of a class helper type TRegExHelper = record helper for TRegEx public procedure AddPCREOptions(PCREOptions: TPerlRegExOptions); end; procedure TRegExHelper.AddPCREOptions(PCREOptions: TPerlRegExOptions); begin with Self do FRegEx.FOptions := FRegEx.FOptions + PCREOptions; end; and use it (not tested): RegEx.AddPCREOptions([preUnGreedy]); 3. Use the ungreedy ? Instead, you can use the ungreedy ? in your regular expressions. See How can I write a regex which matches non greedy? - Stack Overflow. -
Date detection algorithm for strings
pyscripter replied to JohnLM's topic in Algorithms, Data Structures and Class Design
System.RegularExpressions uses PCRE. -
@MarceloHByte Have you also updated JSONDataObjects? There was a significant update after the first post in this topic.
-
Have a look at SynEdit/Source/SynAccessibility.pas at master · pyscripter/SynEdit to see how UI.Automation can be used for accessibility support. SynEdit was one of the first Delphi controls to support UI Automation for this purpose.
-
Indeed. At the moment all we got is some scaffolding. Had Embarcadero declared the UIAutomation functions as delayed no dll would be loaded. Maybe you could submit an issue to that effect. But you could try to do that with your project. Edit Winapi.UIAutomation to add the delayed attribute and include it in your project (not tested).
-
Refactor – Rename (Type, Field, Property) Alternatives in Delphi 13
pyscripter replied to dmitrybv's topic in Delphi IDE and APIs
This gives us some hope. Delphi users do need decent refactoring. Let us know if we can help. This could be a community effort. -
A simple Code Editor trick to quickly jump to predefined locations in a huge unit
pyscripter replied to PeterPanettone's topic in General Help
So does GExperts, but the MMX one is nicer :). -
ai coding MCP server to catch windows debug messages
pyscripter replied to Javier Tarí's topic in General Help
Please.- 9 replies
-
- ai
- claude code
-
(and 2 more)
Tagged with:
-
New Delphi features in Delphi 13
pyscripter replied to David Heffernan's topic in RTL and Delphi Object Pascal
I must say, that an IDE without quality refactoring support does not sound good. The LSP protocol includes refactoring, and I think that the best way forward is to implement it via the LSP server, freeing the IDE itself from such tasks. But first existing LSP issues need to be ironed out. -
No. Who knows, maybe sometime.
-
The following gives a hint in D13: H2077 Value assigned to Test never used: function Test(Value: Integer): Integer; begin Result := -1; if Value > 0 then Result := 0 else Assert(False); end; Is the hint justified? What if Assertions are turned off? Note that in earlier versions you would get a warning if you omit the first line.
-
Indeed.
-
D13 does not let me add breakpoints in Vcl.Forms. Use debug dcus is set and I can debug other Vcl units such as Vcl.Controls. Does anyone else have the same issue?
-
https://embt.atlassian.net/servicedesk/customer/portal/1/RSS-4094