Jump to content

Mahdi Safsafi

Members
  • Content Count

    383
  • Joined

  • Last visited

  • Days Won

    10

Posts posted by Mahdi Safsafi


  1. Quote

    While I appreciate all the engagement in this thread, the whole question was just a simple 'is it possible' idea.

    Well Mike. This is our community. They're all exited and each topic turns just like this one xD ... All people here love coding ... and I'm sure you will love this community too.

    You said your're a new to Delphi. We welcome you here 🙂.

    Now for your question about using "Result := Value if(Condition);" , the sort answer is not possible. 

    I believe that using table lookup is match easy for you:

    
    type
      TRec = record
        Patterns: array of string;
        Result: string;
      end;
    
      PRec = ^TRec;
    
    const
      Table: array [0 .. 1] of TRec = (
        (Patterns: ['Prop1', 'Prop2', 'Prop3', 'Prop4', 'Prop5', 'Prop6', 'Prop7']; Result: 'N'),
        (Patterns: ['PropertyA', 'PropertyB', 'PropertyC', 'PropertyD']; Result: 'DefaultABC')
        );
    
    function LookUp(const AProperty: string): string;
    var
      I: Integer;
      Rec: PRec;
    begin
      for I := 0 to Length(Table) - 1 do
      begin
        Rec := @Table[I];
        if (MatchStr(AProperty, Rec^.Patterns)) then
          exit(Rec^.Result);
      end;
      Result := 'Default';
    end;

    Because you're a new to Delphi, I believe that's the best way for you right now. Later you can optimise it by using binary string search, hash-code, magic-index, crc32 and binary lookup, ... 

    • Thanks 1

  2. 49 minutes ago, Uwe Raabe said:

     That is a valid approach for the Result := Condition part, but in the original example Result is a string while Condition is a Boolean;

    Ah I see ! 

    If I know that the compiler can do a good job about optimisation I'd write something like this:

    begin
      // ...
      // Requires Rio
      const table = [Result, 'true'];
      Result := table[integer(Condition)];
    end;

     desperately waiting for :

    Result := Condition ? Value : Result;

     


  3. 15 hours ago, Uwe Raabe said:

    Write your own procedure:

    
    procedure MPC(var Result: string; const Value: string; Condition: Boolean);
    // MPC stands for Mike's Preferenced Condition
    begin
      if Condition then Result := Value;
    end;
    
    ...
    // call
    MPC(Result, 'N', Property = 'A');

    You can even make it a function, but then you must provide a value for the false condition, too.

    You might consider to inline it ... the call is too expensive !

    Also what about that ?

    Result := Condition or Result;

     


  4. 16 minutes ago, Fritzew said:

    Yeah you can compile to NET, Mono, Java, Mac, Windows, Linux, IOS, Webcore. 
    The Extensions to the Pascal-Language are really impressive. And you can mix Pascal, C#, Java, Swift in the same project. 
    I'm at moment working with it a lot. (Porting a NET library to Mac). It is Amazing, the integrated Test Tools are great.
    Not to say  there is MAC 64 Support....... 

     

    But the best (for me) look at this declaration of a interface and implementing class:
     

    
    type
      testInterface = public interface
        property Name : String;
      end;
      
      testClass = class(testInterface)
        property Name: String;
      end;

    This is amazing....... 

     

    Great ! Few years ago I really liked what they did with Oxygen. The only things that stopped me from using their products was the lack of native CPU support.

    I really appreciate if you can answer the following questions (based on your experience):

    - What do you think about their IDE, is't stable, mature enough ?

    - Did you test to deploy to a native CPU ? and how was the quality/performance there ? 


  5. 2 hours ago, Luis Madaleno said:

    It would be nice to have Delphi as a plugin/addon for VisualStudio.

     

    This approach saves Embarcadero some resources to focus on Delphi (the language) features.

    Several years after the XE editions release and the IDE is still far from good.

    I'm using Rio since the begin of the year and it is better than Tokyo. But still far far way of VisualStudio stability/quality.

    I guess that even RemObjects has a better IDE now with all the features they added to the language.

    What's impressive about RemObjects is their elements. The team took Pascal language into a new level. And with elements 9 they claim that it's possible to compile to a native CPU rather than to IL.


  6. 7 hours ago, Silver Black said:

    You didn't answer me: have you got the patch and the IDE fixes I mentioned? Any improvement?

    Sorry, I got only december patch 2018. 

    The getit package now is working and my cpu is no longer overused by the IDE. But the GUI still the same :classic_sad:


  7. 1 hour ago, Микола Петрівський said:

    Lots of problems can be caused by custom components and experts if they are installed in IDE. They all run in the same address space, so a small bug in third party component can break almost anything. So if you have problems, try to disable third party packages in IDE.

    Another problem is when people try to edit > 10 Mb pas-files or forms with huge amount of components. In such situations IDE is almost screaming: "Do not violate coding best practices, split it in to multiple pieces".

    I didn't install any 3rd party package. My Windows it self had a clean installation and my project was very simple one form and one button (just to test some new things).

    Also a good IDE should works mostly on all situations and not to work just fine when building a "hello world" project. Recently I compiled the LLVM (which is a very huge project) using MSVS and the IDE handled it very good (just got some CPU overusing ... but that was logical) ! 

    One things to mention about 3rd party : nowadays huge projects split plugins into sub-process (when a plugin fails the main app remains safe) ex: chrome. I'm not saying that EMB should go that way. My point is if a company cares about quality ... it will find a workaround. 

    Please use VSCode, Visual Studio, or eclipse and I'm sure you will change your mind about Delphi IDE quality. 

    • Like 1

  8. 1 hour ago, Ugochukwu Mmaduekwe said:

    Currently use VSCode and OmniPascal as my Editor for now. I suggest you try it out.

    The only thing I use the Delphi debugger for is debugging.

    I was a big fun of pascal language. But now I'm not :classic_sad:. The only reason that keeps me using Delphi is it's beautiful VCL. I use notepad++ to quick view/edit my pascal units. But I guess I'll switch to VSCode soon. 


  9. 1 hour ago, Jacek Laskowski said:

    Yes, quality lies and cries. Recently, I have been working a little in VSCode and the node.js ecosystem. Environmental quality is ahead of Delphi for ages. In addition, it works steadily and quickly, although behind the scenes everything is based on slow JS!

    I have serious doubts that Delphi will ever catch up with the world in this area.

    Yes your're absolutely right. I use eclipse daily and it's amazing (never saw 'not responding...'). I also use visual studio community for some c/c++ coding and its quality is really really incomparable to Delphi.

    For VSCode, I just tested it with lite development (editing some python/Perl script) and yes it's shiny ! I always got a negative idea about technologies that use HTML/CSS/GPU for desktop-app (such FM) but VSCode make me change my mind ! 


  10. Hello guys,

    For a long time I was using Delphi XE7 and I was most of the time satisfied about it. Just when I made a clean Windows installation and then installed the community edition Rio. Booom, flickers mostly every where, nonworking getit, a lot of crash, cpu usage 46%, and the famous IDE's caption 'not responding...'. I disabled themes (I believed that was the problem) and yeppp I got a crappy IDE again (EAccessViolation GetIt260.bpl) !! I'm not even going to mention the use of inline-variable !

    I really started thinking to switch to another platform (java, c#, c++ & Qt) ? 

    What do you think guys ?

×