The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 4,261 other subscribers

Watching “Why is C# Evolving This Way?” strengthened my realisation that the Delphi 12 language by now is light years behind C# 12

Posted by jpluimers on 2023/12/07

Though after C# 4 (covariance and contravariance) and C# 5 (async/await) the evolvement of C# might have seemed to slow down a bit, the big picture hasn’t as shown in the [Wayback/Archive] Why is C# Evolving This Way? – YouTube video by Zoran Horvat which comes down to:

  1. Summing up all major changes between C# 1 and C# 12
  2. Grouping them by major aspects:
    • Generics (covariance and contravariance, generic constraints, and covariant return types)
    • Performance upgrades (expression trees, null-conditional, async/await, spans and async streams)
    • Define behaviour in a functional model (ranges, extension methods, and many kinds of pattern matching)
    • “Pure gold” (lambda expressions, expression-bodied methods, nullable references, init-only setters, lambda types, primary constructors, records and record structs) allowing all other aspects to be written in far more elegant ways
  3. Grouping them by usage:
    • DATA (ranges, records, records, record structs, primary constructors, init-only setters and nullable references)
    • BEHAVIOUR (“just” pattern matching)
    • SYNTAX (extension methods, lambda expressions, lambda types, expression-bodied methods)
  4. Explaining the WHY

The last step can only be done by performing the former steps.

LINQ (made possible by generics, expression methods, lambda expressions and expression trees) and immutable collections (from .NET core 1, made possible by the same features as LINQ) were the first big examples of the WHY as it allowed mixing OOP and functional paradigms.

People more closely familiar to F# would probably have guessed by .NET core 1 (and maybe even by C# 3: LINQ prerequisites) that C# was heading steadily into supporting functional programming very well.

That is really the WHY of all the other big C# language enhancements.

The WHY of going functional is separating data and behaviour.

And that is needed because of how we develop software today: with the ever spreading of dependencies on external services, stacks or other data storage (or APIs not even having their own storage) we have far less influence on underlying data models and interfaces. More often than not we are mapping or rewriting data from one set of domain models to another set. Pattern matching based on functional programming is way easier to write and comprehend than procedural coding styles.

Delphi 12, stuck between the language level of C# 3 and C# 4 and a few features of later C# versions is indeed light-years behind.

–jeroen


9 Responses to “Watching “Why is C# Evolving This Way?” strengthened my realisation that the Delphi 12 language by now is light years behind C# 12”

  1. Jan Snyder said

    Old is gold.

  2. Cameron said

    The fundamental problem with C# has been that it is an evolving language with evolving underpinnings making long term development projects in it a serious problem for many shops. Contrast to C++, SQL, ADA, Delphi/Pascal, Python, etc which are nearly immutable at this point. While I appreciate new language features, apps that have long lives need consistency which C# hasn’t really provided at least since its inception. Outside of the unicode conversion in Delphi which IMO was handled poorly, apps built two plus decades ago still compile. That isn’t a big seller for new development or young programmers looking to pad a resume but it certainly is for long running projects.

    In my industry of medical billing many of the big players still run COBOL, MUMPS and even some in old dbase style setups like FoxPro. More modern languages like C# are abject failures at cracking the market and the few that have almost entirely rely on SQL stored procedures for the bulk of the logic while using some form of HTML/Javascript for the front end. In those apps, C# becomes almost a transactional layer to communicate with a database engine.

    C# moving through near countless data layers and interfaces… Winforms, Silverlight, WPF, Xamarin, WinJS, XAML and those are the ones I can remember off the top of my head. Microsoft has a legacy of abandoning their programming languages which makes banking on their programming environments dicey when apps in many industries are measured in decades.

  3. Marco Breveglieri said

    I am long time Delphi developer and (I think) a real Delphi lover, meaning both the language and the tooling, but I must agree with you. 😐

    I believe that many of the most recent additions to the C# language are nothing less than syntactic sugar, especially when they concern abbreviations of some constructs to make them less verbose when, having a fully functional IDE and a code generator (even AI powered!), the tool generates and maintains most of the code automatically.

    However, there are some elements that in my opinion are essential nowadays, for example a simplified and shorter syntax for expressing anonymous methods, i.e. lambda expressions. Maybe there are technical issues that I ignore about the process, but I believe that such a syntax would be easily supportable without breaking compatibility with legacy code and would pave the way for interesting developments in the future.

    I would also like to see something similar to LINQ integrated into the language/RTL, perhaps taking inspiration from the “Spring4D experience” but with all the quality controls that Embarcadero considers appropriate to bring this into Delphi. I would also add constructs to create arrays or collections, in order to complete the started path (well started) with type inference and inline variable declaration.

    I believe that the language is given less effort than it would require in order to accelerate code production especially on open source projects, which are a golden resource, and to better challenge emerging languages.

    I understand that there are large customers with huge projects that need to continue to migrate and support, but new developments and new developers also need to receive more attention.

  4. MohamedMowafaq Arab said

    Sorry to say that this sounds and feels like a paid Ad.

    I think there is no benefit gained by Delphi developers from this article. I think you should show C# advantages if you are eager to let Embarcadero enhance Delphi to compete with C# instead.

    • jpluimers said

      Hopefully the blog post will inspire the Delphi language team to add pressing features for instance allowing libraries to provide async/await or LINQ. Having the groundwork in the language does not mean Delphi should provide the libraries as well: 3rd party library vendors usually have way shorter feature and bug-fix cycles.

  5. Delphi IS Dead.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.