#1 2015-05-08 08:21:19

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,620
Website

I do not like people shoot in my foot, do you?

There was some discussion about the new TStringHelper feature introduced in latest versions of Delphi.
I was told to be some kind of archaic guy, not able to see the benefit of this.
Reducing opinions to a conservative/progressive approach - another famous 10 kinds of coders - is very reductive.

Of course, this was IMHO unfair and my point was that I have the feeling that some later decisions about the Delphi language and RTL are inadequate.
Some changes are welcome. I do no regret the introduction of generics.
But some upcoming changes about the string policy - breaking everything just because we want to align with mainstream C# or Java habits - are just non sense to me.
I really think that Embarcadero deciders like to shoot their own foot.
Or - certainly worse - or own feet!

Offline

#2 2015-05-08 12:49:17

Fritz
Member
Registered: 2015-05-08
Posts: 13

Re: I do not like people shoot in my foot, do you?

I think you are right. All these new changes should be work out of the box.
At moment, if there are new futures it needs two ore more versions of Delphi to work.
For me there is a rule on new futures in Delphi: Use it only if it is stable and proofed.

Offline

#3 2015-05-08 12:52:16

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,620
Website

Re: I do not like people shoot in my foot, do you?

AFAIR TStringHelper was introduced in XE3. And not touched since.
And sometimes, regressions are introduced: e.g. the TList<T> issue in XE8!
So it is difficult to guess how many numbers of versions of Delphi are required about stability.

Thanks for sharing.

BTW, you can circumvent the issue by writing:

    writeln(string(s2).IndexOf('3'),'=2');

Not so clean, right?
And it will copy the whole string content (via _UStrFromPWCharLen) from s2 to a temporary new UnicodeString, just to run the IndexOf() method on it...
Think of a performance nightmare...

Offline

#4 2015-05-12 10:02:37

itSDS
Member
From: Germany
Registered: 2014-04-24
Posts: 516

Re: I do not like people shoot in my foot, do you?

Hi Arnaud in my opinion XE 8 was released to hold a release schedule, it was not ready in all parts. (In fact XE8 = Beta10) All open Beta Bug - Reports where merged into the normal Bug - List.
I hope you posted all bugs in the new embarcadero bug report forum. ?
I agree that TStringHelper only should be a new feature which should not replace the good old things.
The Thing with zero based Strings as a wrapper around one based strings sounds like a bad joke ... The main Reoson for ZBI was the Crossplatform support ?!
Also the arc feature is not the yellow of the egg (germen das gelbe vom ei)

Last edited by itSDS (2015-05-12 12:38:25)


Rad Studio 12.1 Santorini

Offline

#5 2016-06-01 21:12:44

PascalDragon
Member
From: Germany
Registered: 2016-06-01
Posts: 12

Re: I do not like people shoot in my foot, do you?

I know this topic is a bit older already, but since I've just looked a bit through the blog and found this I thought I should comment on two points that were raised in the blog entry.

First the point regarding the String being const: It's not necessarily the immutability, but that the string might be literally a constant.
E.g.

s := 'Hello All World'.Remove(6, 4);

Yes, code like this is supported.

And regarding the unique types and type helpers I think the current approach is only consequential, since you want the types to be different from the base type after all. However I think one could address this by using the inheritance features of helper types (which Delphi sadly only supports for class helpers, but not record helpers, unlike FPC):

type
  TMyString = type String;

  TMyStringHelper = type helper(TStringHelper) for TMyString
  end;

In this example the methods from TStringBuilder would then be available for TMyString variables as well. Maybe I'll implement this in FPC, as it seems a rather logical extension. wink


Free Pascal Compiler Core developer

Offline

#6 2016-06-01 21:35:14

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,620
Website

Re: I do not like people shoot in my foot, do you?

My guess is that it may give much more sense to "inherit" in the specialized type all type helpers from the parent type.

Offline

Board footer

Powered by FluxBB