Delphi Prism / Oxygene Questions

Monday’s podcast will feature an interview with RemObject‘s marc hoffmanDelphi Prism has been released, and it is powered by the RemObjects Oxygene compiler.   If you have any questions about the Oxygene Compiler then this is your opportunity to ask them of marc, as he is the Chief Software Architect for RemObjects.

Please, leave your questions in the box below, and I will cover what I can with marc.  Remember, keep your questions focused on Oxygene and RemObjects as marc won’t be able to answer questions on behalf of CodeGear or Embarcadero.

This entry was posted in Article and tagged , , , , , , , , . Bookmark the permalink.

11 Responses to Delphi Prism / Oxygene Questions

  1. Adam Johnston says:

    Will the Oxygene compiler be re-interrogated back into Delphi Rad Studio IDE ?

  2. Vegar Vikan says:

    Is it possible to use LINQ to SQL / Entity Framework with Prism?

  3. Olaf Monien says:

    @Vegar The followiing working code snippet from Prism might answer the 1st part of your question 😉

    method MainForm.button1_Click(sender: System.Object; e: System.EventArgs);
    var
    lCustomer: Customer;
    LCustomers : List;
    begin
    LCustomers := new List;

    lCustomer := new Customer;
    lCustomer.Name := ‘Olaf’;
    lCustomer.Country := ‘Germany’;
    LCustomers.Add(lCustomer);

    lCustomer := new Customer();
    lCustomer.Name := ‘Jim’;
    lCustomer.Country := ‘USA’;
    LCustomers.Add(lCustomer);

    var GermanCustomers :=
    from Customer in LCustomers
    where Customer.Country.Equals(‘Germany’);

    for Customer in GermanCustomers do begin
    listBox1.Items.Add(Customer.Name);
    end;
    end;

  4. Vegar Vikan says:

    @Olaf: Well, I don’t think it does. The example shows LINQ-syntax in use, but there is no evidence on LINQ to SQL as far as I can see.

  5. Olaf Monien says:

    @Vegar: LINQ to SQL does of course work as well. The first example was meant to be very simple. See this working (still simple) LINQ to SQL example:
    (I’ll post the Customer class on my Blog)

    method MainForm.button2_Click(sender: System.Object; e: System.EventArgs);
    var
    LCustomers: Table;
    LDBMain: DataContext;
    LConnectionString:String;
    begin
    LConnectionString := ‘Data Source=.\SQLEXPRESS;Initial Catalog=DBDEMOS;Integrated Security=True’;
    LDBMain := new DataContext(LConnectionString);
    LCustomers := LDBMain.GetTable();
    var USCustomers := from Customer in LCustomers where Customer.Country = ‘US’ select Customer;

    for each Customer in USCustomers do begin
    listBox1.Items.Add(Customer.Name);
    end;
    end;

  6. Olaf Monien says:

    Please see my blog for the full example. I just noticed that the generic definitions were aten up by the comments engine

  7. Raymond Wilson says:

    I have a couple. 🙂 Well, one big one anyway!

    The language compiled by Oxygene differs in many respects to the Delphi language. Many of the differences are additive, forming a superset of Delphi that natively supports many very useful .NET features and other enhancements.

    However, many of the differences are not additive, they are incompatible, such as ‘unit’ vs ‘namespace’, and ‘:=’ instead of ‘=’ in default var value assignments. These sorts of differences are catered for by the Delphi -> Oxygene conversion tool, but not all!

    A particular case that is not (I think) dealt with is the conversion tool is the prohibition of explicit destructors, but rather classes requiring this are forced to implement the .NET pattern. Dephi provided compiler magic to convert explicit destructors into the .NET pattern, whereas Oxygene does not.

    Considering the enormous amounts of compiler magic being performed by Oxygene to support many other language features, I imagine this would not be hard to do.

    Are there plans to support explicit destructors in Oxygene (like Delphi does)?

    Raymond.

  8. Fabricio says:

    @Raymond

    I’m not from Codegear or RemObjects, but I worked A LOT with VCL.NET and Delphi.NET.

    The great problem with explicit destructors on Delphi.Net is the fact that IDisposable implementation MUST be called by the programmer. On Delphi.Net, it means that you must call TObject.Free (and correlated like FreeAndNil and the like) explicitly.

    Since WPF, Winforms and such things does not call Dispose automatically it means that your classes cannot rely on it being called as the object zero it’s references and/or go out of scope.

    IF .Net Framework would call Dispose automatically if supported when the Garbage Collector destroy the object, explicit destructors would be a real nice and useful compiler magic. But, until today, that won’t happens and explicit destructors are just more one thing to clutter code.

    Delphi.NET (combined with VCL.NET) tried to bring the native programming style to .NET. It failed, because .NET is another completely different beast (I liked Delphi.NET BUT it have a lot of traps because it doesn’t follow the .NET way of doing things).

    Oxygene compiler, on the other way, was designed from scratch to bring Object Pascal to .NET – FOLLOWING the .NET programming model and conventions.

    It’s all my very humble opinion, of course.

    Best regards!

  9. Janos Janka says:

    Where are the following features from Prism?

    IDE:
    – IntelliSense (“Resolve” /SHIFT+ALT+F10/, “Remove unused usings”, etc.)
    – code refactoring
    – entity framework designer
    – class view (or object browser)
    – WCF config editor

    Language features:
    – collection initializers
    – volatile fields (ok, it is not so important)
    – XML comments (///)

    Frankly, Visual C# IDE is much more richer.

  10. Naughty Kiwi says:

    I have never held any interest in creating .NET apps, so I thought Prism was going to be a big yawn for me. But I now have a need to create a web based tool, and given i have no skills in PHP, etc, i realized that Oxygene/Prism could really fit the bill. Hmmm, i guess that is not a question. How about, what is the recommended back-end database for a web based app that may have reasonable but not high traffic?

    Also, the subtle differences between the Delphi and Oxygene languages are annoying (even if logically i may agree with them). Why is the compiler not a bit more forgiving in picking up these differences for Delphi converts?

  11. Pingback: 19 - Delphi Prism Q&A - The Podcast at Delphi.org

Leave a Reply