* Damien Gerard wrote, On 13/11/07 09:31: > > > I think it is the same debate between C++ programmers et PHP programmers.
Nearly. It's a meta-debate on whether or not pascal users should be ALLOWED to use variants, not whether or not pascal should implement everything as a variant. > The first group like strong type checking because they want to know > exacty how their data must be. Or maybe the tedium of conformity is appealing? There are so many of them it is difficult to know all their reasons. I've had to write too much API-glue and conversion in my time, perhaps thats why I like variants. I re-wrote swig-php to make it "easier" and of course ended up writing even more in the process :-) > The second one don't care of it and want lazy programming. This may often be true, but it is also as often un-true. I find it interesting that you choose a flattering generalization for those you agree with and an un-flattering generalization for those you disagree with; and yet it is not clear that those php programmers you disagree with care for pascal and variants anyway. I find generally that when there are two sides to a debate, both sides fail to properly grasp the facts of the other view, preferring to cling to the straw which better justifies their own opinion. If you find duck-typing programmers lazy and not worth associating with, you will never learn that you are wrong. I started hard-core programming in SH, then Turbo Pascal, then Delphi; I wrote a 16 bit multi-threader (later "absorbed" without permission into a Delphi 2 compat library for Delphi 1, I wrote a Delphi 1 form designer well before lazarus, and also an implementation of form inhertiance for Delphi 1). I wrote DPMI extensions to handle call-backs from real-mode device drivers in Delphi. I then went on to PHP and C and re-wrote php-swig to easily link libraries with php (doing all these variant type conversions). I then went on to MS embedded visual C++ for smartphones. Now lazarus is GTK2 and doesn't make my eyes bleed on linux, I'm getting ready to do wince development with lazarus so I can keep my code when I finally get a linux smartphone. I've spent years on both sides of the "typing" fence, and say confidently that anyone who sits strongly on one side of the fence is speaking from a lack of experience. > > I do not agree with that, variant are not needed the most of the time, yes. And fortunately pascal won't raise any warnings if you don't use them. > you always have a pascal routine to make your convertion if needed. but you have to write the code every time. You have to write code to check, convert and raise an exception and there aren't even any decent C style macros to help you do it!! It is NUTS. On top of that the compiler COULD easily do it for you. > If you always need a convertion, may be the type/modeling is not > appropriated. Maybe it is appropriate and maybe you are writing an interface between systems. I accept that you haven't found the need for variants, but please consider there might be a need. > Even if we have powerful computer nowdays, except we are not allowed to have this powerful computer automatically generate the code for us, we have to write it ourselves. > it is not necessary to add useless checks/code. But it is necessary to add USEFUL checks/code, and if the compiler can do it for me, so much the better. > We seek for performance because you don't want to be forced to have a > 3GHz to open an explorer... The FACILITY of variants has nothing to do with performance. The ABUSE of variants has everything to do with performance. But why stop at variants? The abuse of alternate record parts (union in C, I forgot what pascal calls them) is also hell. The abuse of embedded read-write procedures on file records is nuts. > > Another reason would be that I observe with a lazy programming > language that programmers don't take care of their code and provide > unmaintable code. Are you opposed to the facility of variants because you think a load of lazy slack programmers will suddenly start using lazarus like they did VB? > > But it is only my thought I agree with your statements, but I can't see how they are relevant to the facility of variants. Why do those who oppose the facility of variants base their arguments on the situation where only idiots would be using them? I hope the answer is not because it helps them believe they are right. - of course such statements will useless to persuade those who do see other value in variants precisely because it is OTHER value that they see I keep stating why COM is useful; it automatically checks, converts and raises exceptions with data from other systems. It saves a lot of possibly buggy code from having to be written, debugged and maintained by hand. Why aren't people complaining about the overhead of widget encapsulation? Why only about type encapsulation? Because the people who complain about widget encapsulation are not using lazarus so we can't hear them. Sam
