<p>Am 22.07.2015 19:25 schrieb "Paul van Helden" <<a href="mailto:paul@planetgis.co.za">paul@planetgis.co.za</a>>:<br>
><br>
> On Mon, Jul 20, 2015 at 8:39 PM, Marcos Douglas <<a href="mailto:md@delfire.net">md@delfire.net</a>> wrote:<br>
><br>
>> On Mon, Jul 20, 2015 at 3:14 PM, Ralf Quint <<a href="mailto:freedos.la@gmail.com">freedos.la@gmail.com</a>> wrote:<br>
>> > [...] And quite frankly, what I have seen in object oriented code<br>
>> > in recent years, I would rather take as a negative example of evolution, of<br>
>> > ways/things not to go/do...<br>
>><br>
>> That is true.<br>
>> Many programmers think that coding using object orientation only<br>
>> because they use an object-oriented language. They also think that<br>
>> using a more "cool" syntax makes your code more "professional".<br>
>><br>
>> But some evolutions in a language could be a good thing, as Sven have said.<br>
>><br>
> Yes, so for example we currently have:<br>
><br>
> if not (X is TSomeClass) then ..<br>
> if not (5 in [1,2,3]) then ..<br>
><br>
> What is wrong with a language evolving to allow (in addition to the above)?:<br>
><br>
> if X is not TSomeClass then ..<br>
> if 5 not in [1,2,3] then ..<br>
><br>
> I'm not a compiler programmer, but it almost seems like laziness that the second case is not possible already? Maybe something is really hard with multi-word operators?</p>
<p>The compiler is geared towards single word operators (combined with their precedence).</p>
<p>> Convenience should be added to this. Take for example type inference. If the compiler can easily figure out the type of a result, why should I have to declare a variable first with the appropriate type? Of course that means to allow var declarations inside the code block. Something I've always wanted to see in Pascal since my brief stint with C++ in the early 90s. The standard argument against is probably "that is unPascallish" or that it is moving away from strong typing. I disagree: if the compiler can figure things out before runtime you still have strong typing. So, for example, I would like to declare something like this anywhere inside a begin..end block:<br>
><br>
> var A := SomeClassInstance.SomeFunction;</p>
<p>While I agree that type inference /might/ be useful I don't agree with inline variable declarations. One of the main points of Pascal is declare before use. While this is somewhat violated with Delphi compatible generics there one could at least argue that the specialized type is implicitly declared by the generic declaration...</p>
<p>Regards,<br>
Sven</p>