Jump to content

balabuev

Members
  • Content Count

    241
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by balabuev

  1. balabuev

    Delphi 12.1 is available

    Immediate code-completion is good. Dreamed for it for a long time. Additional code-completion settings - also cool.
  2. balabuev

    Check for override

    Self is used for demo code clarity, of course it is not needed here. Yes, you right the code is shorter with inline variables (i don't have them in mind because I usually write libraries for XE2+, so my fail here). Yes, the side effect of bracesless functions calls. Still it looks like inconsistency. By the way, as I mentioned, even "@ProcX" does not help. Yes, you right. And the ClassTAncestor hack is needed because Seek is a virtual method, otherwise we can resolve overloads simpler: Base := TStream(nil).Seek;
  3. balabuev

    Check for override

    I see the topic is old already, but anyway, I'm searching for something faster. So, here is my try: type TAncestor = class procedure ProcX; virtual; procedure DoSomething; end; TDescendantA = class(TAncestor) procedure ProcX; override; end; TDescendantB = class(TAncestor) end; procedure TAncestor.DoSomething; type TProcX = procedure of object; var md: TProcX; begin md := Self.ProcX; if TMethod(md).Code <> @TAncestor.ProcX then // Overridden. else // Not overridden. end; This is faster than previous solutions, but I don't like complicated long code (type declaration, md variable). Btw: procedure TAncestor.DoSomething; type TProcX = procedure of object; var md: TProcX; begin md := Self.ProcX; // Compiles. md := TProcX(Self.ProcX); // Invalid cast :)). // And so: if TMethod(Self.ProcX).Code = ... then // Also invalid cast. ; if TMethod(TProcX(Self.ProcX)).Code = ... then // Also invalid cast. ; // Using "@Self.ProcX" does not work too... end;
  4. balabuev

    Try-Finally-end; & Exit??

    Well, if Embarcadero afraid every single conditional jump, I have nothing more to say. However, even this additional stuff, which has been noted several times, have not been explained. Seems to me invented on-the-fly...
  5. balabuev

    Try-Finally-end; & Exit??

    No sense to report QP.
  6. balabuev

    Try-Finally-end; & Exit??

    If we speak about priority, then I agree, goto is not a frequently used feature. And goto with try/finally - even more rare :). They created code generation for other platforms, like x64 and Android. They added anonimous methods and inline variables - features much more complex than the discussing "goto". So, I understand the answers, like "its not a high priority thing". But, I cannot understand the answers like "its impossible/hard to implement" or "ooo, it will require one additional conditional jump" :) Who cares really about one additional jump?.. I'm personally would prefer that they fix "undo" functionality in the code editor. Code editor, like compilers, is the heart of the IDE...
  7. balabuev

    Try-Finally-end; & Exit??

    Actually, I occasionnaly found my old post with possible combinations of try/finally and try/except and gotos. Re-read it, and found that all cases are ok, except of one. After that I simply followed comments in the topic 🙂. It's strange to me that people here do not want to make the language more self-consistent, especially in this particular case, where not big amount of work in the compiler is required.
  8. balabuev

    Try-Finally-end; & Exit??

    You right, but I think other platforms work similarly. Can check in Win64 and Android. But, what is more important is that it's absolutely identical to Break or Continue, and because of that it will not require, as you said, "significant work in the compiler". Yes, I wanted to mention that also.
  9. balabuev

    Try-Finally-end; & Exit??

    Things, which happens inside finally handling block is not relevant to the discussion, because it happening independent of what exactly causes finally code to execute. It may be Break, it may be exception raising. If we speak about "involved" - yes, several jumps are involved. But, this is a nature of try/finally. They are equally emitted for any finally block, and involved even when finally is executed because of exception raising - the main reason for "finally" to exist. So, these jumps are not even related specifically to Break or Continue. However, we mostly discussing here enchancing of the compiler - the newly required functionality is matter, not existing currently. So, I claim that to support goto with finally(ies) the emitted code will not be in any way more complex than it is now for Break. Specifically, a single "call" instruction for every exiting finally, and a single unconditionnal jump instruction. To be honest, managed local variables in a destination scope complicates the thing, but this is a separate, independed of try/finally aspect.
  10. balabuev

    Try-Finally-end; & Exit??

    It would require transferring control to the finally blocks just identically to Break and Continue - One "call" instruction for each exiting finally and one unconditional jump.
  11. balabuev

    Try-Finally-end; & Exit??

    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.
  12. balabuev

    Try-Finally-end; & Exit??

    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. So, goto should do the same.
  13. balabuev

    Try-Finally-end; & Exit??

    No doubt that eror placement is not good too, since the message itself is about specific goto statement, not about the label generally. But, it's not matter. What is matter - the error itself. They implemented actually the same under-the-hood functionality for Break/Continue, but ignored goto. Because, who need it, right?
  14. balabuev

    Try-Finally-end; & Exit??

    Not a big deal. Actually, even worse for a compiler 🙂
  15. balabuev

    Try-Finally-end; & Exit??

    Yes, my fail. Should be: try goto L1; // Compile error, but why? finally end; L1: Not more mess than Break, Continue or usual "goto".
  16. balabuev

    Try-Finally-end; & Exit??

    While compler implements it for Exit, Break and Continue.
  17. balabuev

    Try-Finally-end; & Exit??

    Same thing, Exit, Break and Continue do, of course, - execute finally(ies) and jump out.
  18. balabuev

    Try-Finally-end; & Exit??

    This one is interesting: try goto L1; // Compile error, but why? finally end; L1: Exit, Break and Continue work in the above case.
  19. balabuev

    VCL Styles Flickering

    Do I understand correctly that a control, which is not a TWinControl (for example, TLabel), has no way to implement flicker free drawing with VCL Styles turned on? It seems that the parent form erases its own background via TFormStyleHook.PaintBackground not excluding child controls. This happens in both: Form.DoubleBuffered = False and Form.DoubleBuffered = True modes.
  20. balabuev

    The Delphi 11.2 release thread

    Hmm. It's helped to some degree.
  21. balabuev

    The Delphi 11.2 release thread

    I copy-pasted LSP from 11.1 as has been suggested above (fortunately, I have 11.1 installed on VM).
  22. balabuev

    The Delphi 11.2 release thread

    I do not experience this issue. Not with D10.4, not with D11. So, from my point of view, both version work approximately the same in this aspect.
  23. balabuev

    The Delphi 11.2 release thread

    I cannot agree with that. Moreover, 10.4 has a way to disable LSP in favor of old code insight engine.
  24. balabuev

    The Delphi 11.2 release thread

    Ctrl+G is also quite limited. Not work for stuff from library files, not work for unit names in "uses" clause.
  25. balabuev

    The Delphi 11.2 release thread

    So, I have to say that killing LSP helps, but not always. What me bothers a lot - is that LSP behavior depends of UI actions - open/close a library unit, switch between opened files in the code editor. It seems to me insane. After killing LSP the first Ctrl+Click on a library type identifier never works. Clicking again on the same identifier - may work fine. Also, I've never seen that Ctrl+Click on an "inherited" keyword worked, despite the fact that this was promoted as a new IDE feature.
×