Jump to content

Wagner Landgraf

  • Content Count

  • Joined

  • Last visited

Everything posted by Wagner Landgraf

  1. Fair enough, it was more an example to show that relying on the parameter type is sometimes not enough. But as a library writer I don't think it's bad to give a better error message to the user of my classes (whose code I have no control of) telling him what he did wrong, instead of raising a cryptic AV and waiting him to realize what he did wrong or even blame the framework itself.
  2. If the interface is required for your whole class to properly work, why you wouldn't want to check it in the constructor? Why allowing a instance to be created in an "invalid" state? You would have to check if the interface is nil everywhere in your code and for no use, since your class won't work without it.
  3. A very common case is when you inject objects and interfaces in the constructor. At the very least you would want to check if they are not nil.
  4. I see lots of discussions about how to properly structure try..finally statements and how it behaves depending if a constructor raises an exception or not; if the object should be created inside or outside the try..finally, if the destructor should have a try..finally inside it, etc. Maybe indeed it's a different one. This is the one I'm reading: https://en.delphipraxis.net/topic/6149-bestpractices-to-raise-or-not-to-raise-an-exception-in-a-class-constructor
  5. Wow, what a long thread and discussion for something "simple". Use the 25-year old pattern for Delphi memory management: Foo := TFoo.Create; try finally Foo.Free; end; And let the exception raising begin. Anywhere.
  6. Wagner Landgraf

    Simple FFT

    Here is mine as well. This thread brought me back in time, this code is from 2003. 🙂 cronos-fft.zip
  7. Just out of curiosity, I wonder if anyone implements interfaces from Exception classes? Like: EMyException = class(Exception, IMyInterface) Of course this would require interfaces would be non-referenced counted, but it would be a way to add arbitrary information to exceptions without having to inherit them from a specific class.
  8. Wagner Landgraf

    Delphi 10.2 / IPWorks - Calculating Amazon MWS signature

    Maybe you can check the source code of the AWS SDK for Delphi, more specifically the AWS Signer unit, and see how it compares to yours and spot any possible difference in algorithm?
  9. Wagner Landgraf

    Exception classes implementing interfaces

    It's an interesting approach when you have a centralize exception handler/processor mechanism - like logging systems, serializers, servers, etc.. It's a way to add metadata to the exception without having to be strict to a specific class hierarchy.
  10. Wagner Landgraf

    Delphi and the new Apple M1 CPU

    That was true for Windows 10, are you sure it will be the same for Windows 11? I believe ARM in Windows 11 will be a 1st class citizen like Intel.
  11. Wagner Landgraf

    Delphi and the new Apple M1 CPU

    Doesn't Windows 11 already provide ARM support?
  12. Wagner Landgraf

    Delphi Package Manager - choices?

    That's exactly the reason why none of them will ever be widely adopted. There should be one single manager that applies all the different ideas. It's not impossible.
  13. Wagner Landgraf

    Delphi Package Manager - choices?

    If I'm not wrong, @Vincent Parrett's package manager puts the packages in a global cache. So if you have multiple projects using the same version of JVCL, only one copy will be in your storage. If a couple of projects use an older version, then you will have two copies of JVCL. So it's the ideal scenario. I guess that's how it works, but he can confirm it.
  14. Wagner Landgraf

    Delphi Package Manager - choices?

    I think the "problem" with Package Manager is that is has to be widely adopted by the community to be very useful. Because the key is that relevant libraries and 3rd parties are available in the package manager. "Unfortunately" Embarcadero is pushing GetIt so it's unlikely we will have a different one being widely adopted, I guess.
  15. Wagner Landgraf

    Console Manager for the Delphi IDE

    Or if you want to find a way to do constant updates and improvements or leave it abandoned.
  16. Wagner Landgraf

    We use DUnitX and it discovers all our silly mistakes before release

    Just bumping this topic to ask: regardless of all the issues, are you guys still using some code coverage tool (if yes, which one), or just do not use it at all? I also miss a good tool for that.
  17. Wagner Landgraf

    How to get the actual UTC time??

    UTCNow := TTimeZone.Local.ToUniversalTime(Now);
  18. Wagner Landgraf

    Tool to inspect properties at run-time?

    That is a different one. There is an object inspector control in FNC UI pack, which is cross-platform, and there is an object inspector in TMS Scripter, which is VCL-only. They have no code in common.
  19. Wagner Landgraf

    Tool to inspect properties at run-time?

    Well, I was the one who made the agreement directly with Dmitry from Greatis. So yes, pretty sure. 🙂
  20. Wagner Landgraf

    Tool to inspect properties at run-time?

    Yes, form designer, object inspector, component combo, all can be used separately.
  21. Wagner Landgraf

    Tool to inspect properties at run-time?

    TMS Scripter has an object inspector control (it's an evolution from the Greatis one): https://www.tmssoftware.com/site/scriptstudiopro.asp. And of course, many other things, a full scripter engine and full IDE.
  22. You can try https://github.com/arimateia/liquid-delphi which is a Delphi implementation of Liquid template engine.
  23. I wonder what is a good way to get the stack trace when an exception happens? I know about madExcept and EurekaLog but I was willing to have something lighter and simpler. After a long Google-Fu session, it looks like using JclDebug is still the way to go? I also read here and there that madExcept is better at such job than JclDebug, and since DebugEngine is provided by the madExcept author, I wonder if it (DebugEngine) is a better alternative than JclDebug? Or is there even a more direct, straightforward way to get the stack trace these days?