I am studying the so called "C# bible" (the book is C#7 in a nutshell) and I see that A LOT of things that there are in delphi are also in C#. Like the File class has identical methods, same for the stream classes names (and the hierarchy), datetime libraries, stopwatch and so on. Well I find C# super powerful, so would it make sense if Delphi had:

I am studying the so called "C# bible" (the book is C#7 in a nutshell) and I see that A LOT of things that there are in delphi are also in C#. Like the File class has identical methods, same for the stream classes names (and the hierarchy), datetime libraries, stopwatch and so on. Well I find C# super powerful, so would it make sense if Delphi had:

- something like "auto" in C++ and "var" in C# (now java has "var" too). I find it very useful! It deduces automatically the type like "auto i = 5" or "var i = 5" gives the same result as "int i = 5"

- the += operator and the -= operator

- the possibility to have something like this: https://pastebin.com/WRi0hd3Q

I do not want to make Delphi a C# with a different syntax but I just think that these would be nice features!
Delphi has copied a lot from C# so it could copy these nice features as well! I do not know technical details but could these be implemented?
https://pastebin.com/WRi0hd3Q

Comments

  1. Chris Rolliston Do you then add the type in a comment after?

    ReplyDelete
  2. Willo van der Merwe No, because if I want to know the type, the IDE can tell me very easily. The flip side is that I feel slightly more IDE-dependant writing C# (which isn't necessarily a bad thing - I appreciate the 'hand in glove' nature of C# and the VS editor).

    That said, we're still only talking about local variables - properties, function returns, and parameters are all still explicitly typed of course.

    ReplyDelete
  3. While I would kill for type interference like most people here, would you like to deal with half baked features (like it has always been the case with our beloved Delphi)??

    ReplyDelete

Post a Comment