Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2010-11

defaultformatsettings

19 messages · 7 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Marco van de Voort

Seems Delphi XE has deprecated all separate variables, and after ten years did the same as FPC, use an absolute trick. And of course they named it differently (FPC: defaultformatsettings Delphi: formatsettings)

Like anything new in Delphi nowadays, it is a record-with-some-helpers

Reply by email

Sven Barth
to Marco van de Voort
Marco van de Voort wrote 5 lines
Seems Delphi XE has deprecated all separate variables, and after ten years did the same as FPC, use an absolute trick. And of course they named it differently (FPC: defaultformatsettings Delphi: formatsettings)

Sigh... always the same -.-

Like anything new in Delphi nowadays, it is a record-with-some-helpers

Just thinking: wouldn't objects in FPC achieve the same as records-with-methods in Delphi? If objects would be extended with "sealed" even the "sudden vmt" problems mentioned some time ago would be gone with simple objects-simulating-delphi-records-with-methods.

Regards,
Sven

Reply by email

Marco van de Voort
to Sven Barth

In our previous episode, Sven Barth said:

Show quoted text 7 lines
> Like anything new in Delphi nowadays, it is a record-with-some-helpers Just thinking: wouldn't objects in FPC achieve the same as records-with-methods in Delphi? If objects would be extended with "sealed" even the "sudden vmt" problems mentioned some time ago would be gone with simple objects-simulating-delphi-records-with-methods.

I don't see the point of extending the life of the old syntax. Just let it be as legacy, and implement new functionality Delphi compatible.

Reply by email

Thaddy
to Sven Barth: Sigh... always the same -.- Just thinking: wouldn't objects in FPC achieve the same as…
Sven Barth wrote 6 lines
Just thinking: wouldn't objects in FPC achieve the same as records-with-methods in Delphi? If objects would be extended with "sealed" even the "sudden vmt" problems mentioned some time ago would be gone with simple objects-simulating-delphi-records-with-methods.

With a risk?.
Wait until XF or something.
XE has a really elegant (well, sort of) vmt handling...

Reply by email

Sven Barth
to Thaddy
Thaddy wrote 10 lines
On 29-11-2010 19:33, Sven Barth wrote: > > Just thinking: wouldn't objects in FPC achieve the same as > records-with-methods in Delphi? If objects would be extended with > "sealed" even the "sudden vmt" problems mentioned some time ago would > be gone with simple objects-simulating-delphi-records-with-methods. > With a risk?. Wait until XF or something. XE has a really elegant (well, sort of) vmt handling...

You are aware that I'm talking about "object" (the old TP style OOP) not "class" (the Delphi style OOP)? "object" is deprecated in Delphi since I don't know how long, but in FPC it's still maintained and even extended.

But what do you mean with "elegant vmt handling" in XE?

Regards,
Sven

Reply by email

Michael Van Canneyt
to Marco van de Voort: Seems Delphi XE has deprecated all separate variables, and after ten years did the same…
Marco van de Voort wrote
Seems Delphi XE has deprecated all separate variables, and after ten years did the same as FPC, use an absolute trick. And of course they named it differently (FPC: defaultformatsettings Delphi: formatsettings)

Oh well, this is an easy one, for once:

var
   formatsettings : TXYZ; absolute defaultformatsettings;

Michael.

Reply by email

Paul Ishenin
to Sven Barth: You are aware that I'm talking about "object" (the old TP style OOP) not "class" (the…
Sven Barth wrote
You are aware that I'm talking about "object" (the old TP style OOP) not "class" (the Delphi style OOP)? "object" is deprecated in Delphi since I don't know how long, but in FPC it's still maintained and even extended.

In delphi it is still maintained and even extended too.

For example objects got the extended syntax as well as classes:

   Obj1 = object
     type
       TF = integer;
     var
       F: TF;
   end;

Best regards,
Paul Ishenin

Reply by email

Marco van de Voort
to Paul Ishenin

In our previous episode, Paul Ishenin said:

Show quoted text 5 lines
30.11.2010 1:23, Marco van de Voort wrote: > Like anything new in Delphi nowadays, it is a record-with-some-helpers Time to implement this kind of records in FPC?

If generics are more mature, we are going to need it.

E.g. I'm thinking of parameterizing some of the core fpimage readers/writers with stuff like

   YUV422 = record
             pixel : word;
             function red:integer;    inline;
             function green:integer;  inline;
             function blue:integer;   inline;
             function alpha:integer; inline;
            end;

for pixel value

Since r/g/b are only shift+ and mask, and alpha is even constant, that would speed up the reader etc.

I still plan to keep a basic polymorphic everything to 64-bit pixel readers, but have avenues to instantiate a couple of faster paths. I hope to reach speedups in the magnitude of 50 times. (currently my routines are 100 times faster, but that is handcoded for a couple of formats without any general purposeness)

Reply by email

Thaddy
to Sven Barth: You are aware that I'm talking about "object" (the old TP style OOP) not "class" (the…
Sven Barth wrote 8 lines
You are aware that I'm talking about "object" (the old TP style OOP) not "class" (the Delphi style OOP)? "object" is deprecated in Delphi since I don't know how long, but in FPC it's still maintained and even extended. But what do you mean with "elegant vmt handling" in XE?

I am referring to the reworked rtti handling and the TVirtualMethodInterceptor class in the rtti unit. (Delphi XE)

Reply by email

Marco van de Voort
to Michael Van Canneyt: Oh well, this is an easy one, for once: var formatsettings : TXYZ; absolute…

In our previous episode, Michael Van Canneyt said:

Show quoted text 9 lines
> > Seems Delphi XE has deprecated all separate variables, and after ten years > did the same as FPC, use an absolute trick. And of course they named it > differently (FPC: defaultformatsettings Delphi: formatsettings) Oh well, this is an easy one, for once: var formatsettings : TXYZ; absolute defaultformatsettings;

That + deprecate the old separate ones and updated user changes trunk? I'll do this today when I have time.

Then the only question is if we should deprecate defaultformatsettings. I decided to not do this today. Even if we do this, a lot of parameters for the overloaded "formatsettings" routines need to be renamed (to aformatsettings?) for this first to avoid accidental clashes.

Reply by email

Unknown author
to Marco van de Voort
Marco van de Voort wrote 18 lines
In our previous episode, Michael Van Canneyt said: >> >> Seems Delphi XE has deprecated all separate variables, and after ten years >> did the same as FPC, use an absolute trick. And of course they named it >> differently (FPC: defaultformatsettings Delphi: formatsettings) > > Oh well, this is an easy one, for once: > > var > formatsettings : TXYZ; absolute defaultformatsettings; That + deprecate the old separate ones and updated user changes trunk? I'll do this today when I have time. Then the only question is if we should deprecate defaultformatsettings. I decided to not do this today. Even if we do this, a lot of parameters for the overloaded "formatsettings" routines need to be renamed (to aformatsettings?) for this first to avoid accidental clashes.

I would never deprecate it. It was our solution, and there is no need to deprecate it. The other one is 'for delphi compatibility'.

Michael.

Reply by email

Sven Barth
to Paul Ishenin: In delphi it is still maintained and even extended too. For example objects got the…
Paul Ishenin wrote 15 lines
30.11.2010 2:31, Sven Barth wrote: > You are aware that I'm talking about "object" (the old TP style OOP) not > "class" (the Delphi style OOP)? "object" is deprecated in Delphi since I > don't know how long, but in FPC it's still maintained and even extended. In delphi it is still maintained and even extended too. For example objects got the extended syntax as well as classes: Obj1 = object type TF = integer; var F: TF; end;

Ok, I hadn't known that.

At work we use Delphi 6 (since this month we are migrating to Delphi
2007) and I myself have only prevely used Delphi 2006 (I then switched to Lazarus).

Regards,
Sven

Reply by email

Marco van de Voort
to Unknown author: I would never deprecate it. It was our solution, and there is no need to deprecate it.…

In our previous episode, said:

Show quoted text 7 lines
> Then the only question is if we should deprecate defaultformatsettings. I > decided to not do this today. Even if we do this, a lot of parameters for > the overloaded "formatsettings" routines need to be renamed (to > aformatsettings?) for this first to avoid accidental clashes. I would never deprecate it. It was our solution, and there is no need to deprecate it. The other one is 'for delphi compatibility'.

Never is a long time. Well, anyway even if we deprecated it in the 2.6 cycle, really removing it is then only in 2.8 or 2.10.

But I don't have really strong feelings about this. It's just that if the global vars are deprecated, and the defaultformatsettings are, we can kill them if the absolute tricks cause problems. We can leave them in indefinitely till there really are problems.

Reply by email

Sven Barth
to Paul Ishenin: Time to implement this kind of records in FPC? I tried once but failed because of big…
Paul Ishenin wrote 7 lines
30.11.2010 1:23, Marco van de Voort wrote: > Like anything new in Delphi nowadays, it is a record-with-some-helpers Time to implement this kind of records in FPC? I tried once but failed because of big changes they require.

What about just using "sealed objects" for this in mode Delphi (maybe change record in that mode to mean "sealed object" by default)? I don't know how much sense that makes, but as both reside on the stack and both can contain methods (I'm talking about the extended records) I see no problem here.

Regards,
Sven

Reply by email

Sven Barth
to Thaddy: I am referring to the reworked rtti handling and the TVirtualMethodInterceptor class in…
Thaddy wrote 11 lines
On 29-11-2010 20:31, Sven Barth wrote: > > You are aware that I'm talking about "object" (the old TP style OOP) > not "class" (the Delphi style OOP)? "object" is deprecated in Delphi > since I don't know how long, but in FPC it's still maintained and even > extended. > > But what do you mean with "elegant vmt handling" in XE? > I am referring to the reworked rtti handling and the TVirtualMethodInterceptor class in the rtti unit. (Delphi XE)

Ah ok. Thanks for clarifying.

Regards,
Sven

Reply by email

Paul Ishenin
to Sven Barth: What about just using "sealed objects" for this in mode Delphi (maybe change record in…
Sven Barth wrote 5 lines
What about just using "sealed objects" for this in mode Delphi (maybe change record in that mode to mean "sealed object" by default)? I don't know how much sense that makes, but as both reside on the stack and both can contain methods (I'm talking about the extended records) I see no problem here.

Objects don't know about "case" block inside.

Best regards,
Paul Ishenin

Reply by email

Florian Klaempfl
to Marco van de Voort: In our previous episode, Michael Van Canneyt said: That + deprecate the old separate ones…
Marco van de Voort wrote 15 lines
In our previous episode, Michael Van Canneyt said: >> >> Seems Delphi XE has deprecated all separate variables, and after ten years >> did the same as FPC, use an absolute trick. And of course they named it >> differently (FPC: defaultformatsettings Delphi: formatsettings) > > Oh well, this is an easy one, for once: > > var > formatsettings : TXYZ; absolute defaultformatsettings; That + deprecate the old separate ones and updated user changes trunk? I'll do this today when I have time. Then the only question is if we should deprecate defaultformatsettings.

IMO not. It's simply an FPC construct.

Reply by email

Sven Barth
to Paul Ishenin: Objects don't know about "case" block inside. Paul Ishenin
Paul Ishenin wrote 8 lines
30.11.2010 15:52, Sven Barth wrote: > What about just using "sealed objects" for this in mode Delphi (maybe > change record in that mode to mean "sealed object" by default)? I don't > know how much sense that makes, but as both reside on the stack and both > can contain methods (I'm talking about the extended records) I see no > problem here. Objects don't know about "case" block inside.

Right. -.- I forgot about that, although I use it here and then...

Regards,
Sven

Reply by email