On Wed, Jul 22, 2015 at 7:47 PM, Sven Barth <pascaldra...@googlemail.com> wrote: > > > 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? > > The compiler is geared towards single word operators (combined with their > precedence). > Is it technically infeasible to expand this to two-word operators? SQL did it..
> > 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: > > > > var A := SomeClassInstance.SomeFunction; > > 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... > I have never managed to understand why "declare before use" is so important to Pascal. I get the bit about strong typing and doing everything possible to eliminate errors at compile time, but I still don't get why. If this is central to what makes something "Pascal", I would love to be pointed to a good explanation. I'm not trying to be a pain here. I've been programming in Pascal, full time, for most of my life. It has always puzzled me why everything has to be declared first.
_______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel