[Lazarus] Easiest way to "case" strings

Marco van de Voort marcov at stack.nl
Wed Mar 25 15:23:44 CET 2009


On Sun, Mar 22, 2009 at 04:06:32PM +1000, Alexander Klenin wrote:
> > Alexander Klenin schrieb:
> > There exist too many options with string comparison. In a table lookup
> > the compare method can be supplied by the application, in a case
> > statement this would require another syntax extension.
> 
> There are also many ways to implement strings and dynamic arrays --
> but this did not stopped Object Pascal author from adding them,
> and I think he was right, even if some of his design decisions are suboptimal.

Since we are close to 20 stringtypes + conversions now, I doubt that this is
really the problem.

> This "consider all roads then choose none" approach will, obviously,
> never allow you to get anywhere ;-)

No. It is just to chose the ones that matter, not the ones that are merely
possible.

> > Many Delphi extensions to the Pascal language break fundamental design
> > rules. It's bad enough that FPC (and Lazarus) has to support such
> > aberrations for compatibility reasons,
> 
> I agree that some extensions were suboptimally designed, in particular
> dynamic arrays,
> but "aberrations"? Can you give an example?

What problem does "for in" really solve? 

Is having 6 levels of information
hiding (private,public,strict protected, strict private,protected,published)
or are the strict* ones just to stop the whining of people that come from
other languages?

What is the function of being able to add methods to records? 

What is the real use of duplicating const type and var as nested variants
inside classes?

Have a look at:
http://www.stack.nl/~marcov/delphilater.txt
 
> > but further extensions should be added very carefully,
> Yes, but still they should be added -- that was my point.

The old rule used to be that
- it should make something possible that is not doable otherwise.
- _or_ it should be a construct that is used so much that timesavings are
  noticable

And string-case for my feeling belongs in neither. It is just about racking
up bullet lists in language wars.

But apparantly that has been simplified to 'everybody that submits a patch'.
 
> While I deeply respect Wirth's contributions to programming language design,
> I think Modula and especially Oberon are not the best sources for inspiration.
> Object Pascal has log ago taken different direction -- for example,
> if we "take into account" Oberon, then we should, as a first step,
> remove strings, classes, virtual functions and "for" loop.
> I do not think this is a good way to evolve FPC ;-)

Judge the extensions to the above.

In my opinion too many people focus way too much on the language, and too
little on solving the problem: doing safe programming in a sane amount of
time (*). A language is about more than just weighing the language manual.

(*) different tradeoffs safe/time are possible.



More information about the Lazarus mailing list