Jump to content

Dalija Prasnikar

Members
  • Content Count

    1049
  • Joined

  • Last visited

  • Days Won

    91

Posts posted by Dalija Prasnikar


  1. 36 minutes ago, Daniele said:

    For some reason in my code I had to move the addlog procedure declaration from public to private and now it works.

    This is very strange. But the whole issue has been strange from the beginning. AddLog should work both inside or outside task. The only possible explanation would be that AddLog was never called from within the task because some code before it is called triggered exception.


  2. 43 minutes ago, Daniele said:

    Sorry but does my code work for you? Ok for ErrorData it is indeed redundant. But I'm very surprised that it works for you. I've tried and tried but I just have no way to make it work.

    Yes, your code works for me. so the problem must be in some other code you have. Is the AddLog procedure called at all, or just the writing to file does not work? The best thing you can do is to create empty project and test writing to log there.


  3. 25 minutes ago, Daniele said:

    Yes, I debugged it but no exceptions are triggered.

    Saving to log file works fine to me (from the task). The only thing I noticed is that you don't have ErrorData defined within the AddLog procedure. Move it inside, as there is no reason to have broader scope.


  4. Have you tried debugging? 

     

    Besides the fact that your AddLog code is not exactly thread-safe (if you call it from multiple threads, you can get corrupted log), there is nothing there preventing it to work. And the thread-safety issue would be solved with TThread.Sysnchronize call. So if there is nothing written, your code probably never reaches AddLog call. Make sure that there is no exception raised before that call.


  5. 1 hour ago, PeaShooter_OMO said:

    Do you have a project on it that is bigger than your largest Delphi project? For which language? If so, how does that IDE behave with that project?

    My projects are all rather small, regardless of the platform and the tools I am using.

     

    I am personally using Android Studio with Java. Comparing to Delphi, Android Studio is way more resource hungry and slow. 

     

    Opening a project takes more than a minute, building about 3 (also highly depends on how AS mood at the moment as rebuilding the same project can last up to 10 minutes). Similar Delphi sized project (actually a tad larger) opens up immediately, and builds in under a minute. AS gobbles up over 4 GB of memory while doing that and burns my CPU at 98%. While Delphi uses a little over 600 MB and 8% CPU. 

     

    Also I had a AS bug report open for years before it was finally fixed, where it would eat up memory on opening second project, and crawl down to a halt and had to be killed through Task Manager. So if I had to switch projects I had to restart the IDE. I am sayin all this so that people wouldn't think that the grass is much greener on the other side and that there are no problems. But the IDE has more features than Delphi and it definitely has some I would want to have.

     

    My son is using IntelliJ for Java, and Rider for C# and he is very satisfied with both.

    • Like 2

  6. There is one other feature I like, is ability to change editor font size in pixels. I would like to use Consolas, but size 10 is too small (13 pix) and size 11 is too large (15 pix). I am using 14 pix in other editors. I would post the QP number for that feature request, but it is currently down. But it seems that this would have to wait for new editor because AFAIK the current one can only deal with size in points.

     

    One thing they implemented in Delphi 12 is increasing the line height, which is another important feature, when my eyes switch to overly sensitive mode.


  7. 9 minutes ago, dummzeuch said:

    Hm, I have just read through that page and another one but I'm not quite sure whether I would find inline hints useful or annoying. I'd probably have to try it.

    I am used to named parameters in Swift (which you have to explicitly write), so once you get used to the fact there there is more information in code, you learn to easily ignore it when you don't need it, but when you do need it is extremely helpful when you are going through code you are not familiar with or your own old code. Yes, you could also hover over the method to see the names and types, but that significantly slows down reading the code. 

     

    I even find it helpful for the code I know well. I guess my brain likes the extra information being served on a plate. 

    • Like 2

  8. 12 minutes ago, dummzeuch said:

    I've moved this to a new topic because it is not much related to Delphi 12 being released.

    OK, I bite: What's your favorite feature(s) in a JetBrains editor that Delphi does not offer? (Excluding things that Delphi offers but that don't work.)

    Inlay parameter hints. It is extremely useful for reading and understanding the code https://www.jetbrains.com/help/idea/inlay-hints.html#change-inlay-hints-appearance

     

    Excluding things that Delphi offers but don't work is tough restriction 😉 Well working code completion and refactoring are next. 

    • Like 1

  9. 21 minutes ago, DelphiUdIT said:

     

    "C:\ProgramData\Embarcadero"

    DO NOT DELETE THIS FOLDER It contains license information.

     

    If there is a reason for removing or editing some license, it should be done through license manager. If it really needs to be deleted, then copy it to some place first, so you can put it back just in case.


  10. 1 hour ago, balabuev said:

    additional conditional jump

    Because conditional jump requires more logic in compiler than simple single jump. Yes, there are other more complicated things in the compiler, that is besides the point. We are talking about goto command which is rarely used and often even considered obsolete. While it has its use cases, extending the goto functionality is really the last thing we need. In that context how complicated feature might be matters. That is why I (erroneously) opened discussion with how many jumps it needs and this could have been a reason why using goto to jump outside try...finally was not implemented.


  11. 3 hours ago, balabuev said:

    I cannot imagine, where the difference come from. Moreover, handling finally is a "call", not jump. So, what Break do, is a single "call" to handle each exiting try/finally, and then - usual jump.

     

    image.thumb.png.304ef3c2cddb902812f34cb6ca0b9151.png

     

    The jump to finally happens behind that call. If you use Continue, the jump will become more obvious.

    3 hours ago, balabuev said:

    So, goto should do the same.

    File a QP report if you think it is important to have it.

     

    4 minutes ago, balabuev said:

    You are wrong. Can you provide sample code, in which a single Break will require more than one jump? I mean the code in which I can comment the Break and compare generated asm.

     

    You can use any code you wish. Like I have already said, I was wrong that there is only single jump involved for the Break and Continue. 


  12. 2 hours ago, dummzeuch said:

    No. Both, break and continue make a jump to the finally block and then to the end or beginning of the loop. Not a big difference to what a goto must do. The only difference is that goto can jump to an arbitrary position in the code while break and continue only jump to the end or beginning of a loop.

    You are right, I forgot that there could be code in the loop after the finally, which requires additional jump. 


  13. 8 minutes ago, balabuev said:

    They implemented actually the same under-the-hood functionality for Break/Continue,

    No, it is not the same functionality. Break and Continue will just make single unconditional jump to the finally, while goto would require two jumps, one of them conditional. It is far from being the same. 


  14. 32 minutes ago, Kas Ob. said:

    that getter can be function in singleton or global one, or just a property with getter, this getter will have CriticalSection instead of TMonitor, i just hate TMonitor, it is up to you after all, both will do fine.

    You cannot use TMonitor in such scenario as you don't always have live instance to call upon. 

     

    Also there is a simpler code than your example commonly used for double checked locking. However, that pattern assumes that calling the constructor is all that is needed to fully initialize the object. Only if there is additional initialization needed after construction, there is a need for temporary object.

     

    So this code would look like:

     

    function GetMyObject: TMyObject;
    begin
      if FMyObject = nil then
        begin
          FLock.Enter;
          try
            if FMyObject = nil then
              FMyObject := TMyObject.Create;
          finally
            FLock.Leave;
          end;
        end;
      Result := FMyObject;
    end;

    or with additional initialization

     

    function GetMyObject: TMyObject;
    var
      TempMyObject: TMyObject;
    begin
      if FMyObject = nil then
        begin
          FLock.Enter;
          try
            if FMyObject = nil then
              begin
                TempMyObject := TMyObject.Create;
                // additional initialization for TempMyObject
    
                FMyObject := TempMyObject;
              end;
          finally
            FLock.Leave;
          end;
        end;
      Result := FMyObject;
    end;

     

     

    • Like 3

  15. 11 minutes ago, dummzeuch said:

    ... unless your parameter is declared as const.

    If Foo  is reference counted type, then GetFoo will require hidden reference created to properly initialize reference counting, regardless of how DoSomethingWithFoo is declared. If it is declared as const that only means there will be no additional reference counting involved (_IntfCopy and _IntfClear) calls.

     

    Hidden reference is equivalent of the explicitly declared local variable. It is created when there is a need for holding a reference to something for calling _IntfCopy and _IntfClear methods. If there is already a reference (when passing parameter to some procedure where parameter is not declared as const) then there will be no hidden reference because _IntfCopy and _IntfClear can be called on that reference directly.

     

    Same principle applies not only for interface , but also for other reference counted types like strings and dynamic arrays, the only difference is in particular reference counting methods that will be called.

    • Like 3

  16. 1 minute ago, Angus Robertson said:

    Indeed, I thought I'd changed the package suffix to 29, but somehow the change got lost, and so D12 packages were built with suffix 28 which D11 then found due to so many different paths searched, and crashed the IDE on start-up.  

    Ahh... that is a slightly different case... but, yes, it can be a nightmarish scenario.  I had some of my own libraries with messed extensions and it took me a while to realize what is wrong.

     


  17. 2 hours ago, Angus Robertson said:

    Not sure if my problem with D11.3 relates to Parnassus. 

     

    It seems Delphi has taken a dislike to dclframviewer280.bpl built months ago, which is HtmlViewer, I added that to D12 and probably got some packages wrong.

    Well, 280 is a version 11, and Delphi 12 is 290 so Delphi 12 will definitely not like such bpl.

    • Like 1
×