EugeneK 22 Posted 12 hours ago Hi Is there any chance that namespaces will be added in Spring4d code? e.g. System.SysUtils instead of SysUtils Share this post Link to post
EugeneK 22 Posted 11 hours ago In my projects I don't have anything in 'Unit Scope names' and 'Unit aliases', so it won't compile if I just add it as is. All other 3rdparty libraries that I use have it, so I don't want to add it back. 2 Share this post Link to post
Anders Melander 1912 Posted 11 hours ago 30 minutes ago, Stefan Glienke said: Why? Supposedly compiles faster...? Share this post Link to post
Zoran Bonuš 12 Posted 11 hours ago 34 minutes ago, Stefan Glienke said: Why? I guess to help the compiler a liittle bit, as explained here: https://blog.marcocantu.com/blog/2022-december-suggestions-help-delphi-compiler.html Share this post Link to post
Stefan Glienke 2059 Posted 11 hours ago The claim that it compiles faster is bogus - prove me wrong. Most compile time from spring4d comes from generics, which I reported years ago. Also, my suggestion for third-party libraries is to pre-compile them, which removes any dependency on the project options in your project. Currently, Spring4d supports down to XE, and as long as that is the case, I am not putting even more conditionals into the code than there already are. 2 Share this post Link to post
EugeneK 22 Posted 10 hours ago 37 minutes ago, Anders Melander said: Supposedly compiles faster...? Also it forces unified style across all the code and improves readability. Share this post Link to post
Anders Melander 1912 Posted 9 hours ago 35 minutes ago, EugeneK said: improves readability I'm not sure I agree on that. I've just been through a refactoring session where SysUtils was replaced with System.Sysutils which in turn made it necessary to resolve a series of type references as System.Sysutils.PByteArray instead of Sysutils.PByteArray due to a duplicate type declaration. That certainly didn't improve readability. Share this post Link to post
Kryvich 166 Posted 2 hours ago (edited) Embarcadero can sometimes move system types and functions from one RTL unit to another. Should we care in which specific RTL module a particular system type is declared? The Unit Scope Names setting helps abstract away implementation details. Edited 2 hours ago by Kryvich Share this post Link to post
baoquan.zuo 26 Posted 1 hour ago There is one approach without using many conditional defines: - Just use fully qualified/scoped unit names in use clauses - Create a shared .optset to be used by all XE-specific projects - Use unit aliases to map System.SysUtils to SysUtils, System.Actions to System (Ignore it), etc. in the optset. I did try this way and I am OK with it, but I am not sure what is the limit of the unit aliases/performance boost, an you have to use conditional defines when reference full-qualified type/members of RTL (should be limited). Share this post Link to post
Anders Melander 1912 Posted 58 minutes ago 1 hour ago, Kryvich said: The Unit Scope Names setting helps abstract away implementation details. Huh? How do they do that? Can you give an example? Share this post Link to post