ahausladen / JsonDataObjects

JSON parser for Delphi 2009 and newer
MIT License
413 stars 160 forks source link

AUTOREFCOUNT #38

Closed Sorien closed 7 years ago

Sorien commented 7 years ago

There seems to be some support for auto ref counting but when i define AUTOREFCOUNT can't compile project in D2009

[DCC Error] JsonDataObjects.pas(2257): E2003 Undeclared identifier: 'FRefCount'
[DCC Error] JsonDataObjects.pas(2270): E2003 Undeclared identifier: 'FRefCount'
[DCC Error] JsonDataObjects.pas(2777): E2003 Undeclared identifier: '__ObjRelease'
[DCC Error] JsonDataObjects.pas(2783): E2003 Undeclared identifier: 'AtomicIncrement'
[DCC Error] JsonDataObjects.pas(2783): E2003 Undeclared identifier: 'FRefCount'
[DCC Error] JsonDataObjects.pas(4677): E2003 Undeclared identifier: 'FRefCount'
[DCC Error] JsonDataObjects.pas(4690): E2003 Undeclared identifier: 'FRefCount'
ahausladen commented 7 years ago

AUTOREFCOUNT is not a feature of JsonDataObject, it is a feature of the mobile (Android, IOS) compilers and is defined by the mobile compilers. Defining it yourself doesn't work (as designed).

Sorien commented 7 years ago

oh sorry, i have no idea about new delphi features, are there any plans to make TJsonBaseObject ref counted?

ahausladen commented 7 years ago

It is ref-counted if you use a mobile compiler. For non-mobile compilers: no, because ref-counting would require changes to the compiler and source code can't do this.

Sorien commented 7 years ago

hmm i thought using refcounted interfaces sometning like

var
  Obj, ClonedObj: IJsonObject;
begin
  Obj := TJsonObject.ParseUtf8('{ "foo": [ "bar", {}, null, true, false, { "key": "value" } ] }') as TJsonObject;
  ClonedObj := TJsonObject.Create;
   // Make a copy of Obj
  ClonedObj.Assign(Obj);
  ShowMessage(ClonedObj.ToJSON(False));
end;

couse i have huge problem with mem leaks (not fault of your library), and it would make my life a bit easier, ok never mind i've got answer, btw really nice lib and 👍 for D2009 support :)

ronaldhoek commented 7 years ago

Don't think .NET but think Delphi ;)

cesarliws commented 7 years ago

@Sorien I wrote my JSON builder using interfaces and designed as fluent interface that wraps JsonDataObjects, that way I can have the better of both, auto ref-count and JsonDataObjects

danieleteti commented 7 years ago

Would be nice to have it as open source. Do you plan to relese it as is?

DT

Il 31 ago 2017 2:15 PM, "Cesar Romero" notifications@github.com ha scritto:

@Sorien https://github.com/sorien I wrote my JSON builder using interfaces and designed as fluent interface that wraps JsonDataObjects, that way I can have the better of both, auto ref-count and JsonDataObjects

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ahausladen/JsonDataObjects/issues/38#issuecomment-326277565, or mute the thread https://github.com/notifications/unsubscribe-auth/ABXMpH-wJ350J8HtNgaw-HtCjDs9jTuEks5sdqPygaJpZM4PG_T3 .

cesarliws commented 7 years ago

Yes I can put on my public repository, the lack of free time have held me of doing that so far. I can do it in the next weekend, then I'll let put the link in this thread.

Cesar Romero http://www.cesarromero.com.br

2017-08-31 9:31 GMT-03:00 Daniele Teti notifications@github.com:

Would be nice to have it as open source. Do you plan to relese it as is?

DT

Il 31 ago 2017 2:15 PM, "Cesar Romero" notifications@github.com ha scritto:

@Sorien https://github.com/sorien I wrote my JSON builder using interfaces and designed as fluent interface that wraps JsonDataObjects, that way I can have the better of both, auto ref-count and JsonDataObjects

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ahausladen/JsonDataObjects/issues/38#issuecomment- 326277565, or mute the thread https://github.com/notifications/unsubscribe-auth/ABXMpH-wJ350J8HtNgaw- HtCjDs9jTuEks5sdqPygaJpZM4PG_T3 .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ahausladen/JsonDataObjects/issues/38#issuecomment-326280967, or mute the thread https://github.com/notifications/unsubscribe-auth/ADxSLZhHu7DeAcymxd42pVgK5zMmLD-Hks5sdqeRgaJpZM4PG_T3 .

danieleteti commented 7 years ago

Good. Thank you. Would be nice to integrate in dmvcframework 3.x as default serializer intrerface.

DT

2017-08-31 14:34 GMT+02:00 Cesar Romero notifications@github.com:

Yes I can put on my public repository, the lack of free time have held me of doing that so far. I can do it in the next weekend, then I'll let put the link in this thread.

Cesar Romero http://www.cesarromero.com.br

2017-08-31 9:31 GMT-03:00 Daniele Teti notifications@github.com:

Would be nice to have it as open source. Do you plan to relese it as is?

DT

Il 31 ago 2017 2:15 PM, "Cesar Romero" notifications@github.com ha scritto:

@Sorien https://github.com/sorien I wrote my JSON builder using interfaces and designed as fluent interface that wraps JsonDataObjects, that way I can have the better of both, auto ref-count and JsonDataObjects

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ahausladen/JsonDataObjects/issues/38#issuecomment- 326277565, or mute the thread https://github.com/notifications/unsubscribe- auth/ABXMpH-wJ350J8HtNgaw- HtCjDs9jTuEks5sdqPygaJpZM4PG_T3 .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ahausladen/JsonDataObjects/issues/38#issuecomment- 326280967, or mute the thread https://github.com/notifications/unsubscribe-auth/ ADxSLZhHu7DeAcymxd42pVgK5zMmLD-Hks5sdqeRgaJpZM4PG_T3 .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ahausladen/JsonDataObjects/issues/38#issuecomment-326281763, or mute the thread https://github.com/notifications/unsubscribe-auth/ABXMpITN_LPu6nhy_rWGSLdlH23ZBYp0ks5sdqhpgaJpZM4PG_T3 .

-- Daniele Teti CEO & CTO bit Time Professionals web: www.bittimeprofessionals.it, www.bittimeprofessionals.com blog: www.danieleteti.it my books: www.danieleteti.it/delphi-cookbook mobile: +39 3496626822 office: +39 06 20761499