Re: [fpc-pascal] ppcjvm issues

2017-01-31 Thread Michael Schnell
On 27.01.2017 22:55, Jonas Maebe wrote: The collector only runs very occasionally. If you need instant freeing, a garbage-collected platform is not what you want. True. It of course should not trigger the garbage collection process (AFAIK, this is possible by a certain API call, but totally

Re: [fpc-pascal] ppcjvm issues

2017-01-31 Thread Michael Schnell
On 29.01.2017 10:00, Lars wrote: "DisposeOf breaks ARC. ARC tends to brake Object Pascal paradigms, anyway, so the question might be where to draw the line... -Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

Re: [fpc-pascal] ppcjvm issues

2017-01-31 Thread Michael Schnell
On 27.01.2017 15:36, Dmitry Boyarintsev wrote: Why dummy? if it should be like this ... ObjectPascal provides FreeAndNil() for this, as Free does not return any value assigned to "self". -Michael ___ fpc-pascal maillist -

Re: [fpc-pascal] ppcjvm issues

2017-01-29 Thread Marcos Douglas B. Santos
On Sun, Jan 29, 2017 at 6:04 AM, Lars wrote: > Another interesting idea, from all this discussion, is whether a mixed > Garbage Collected/Manually Collected language could exist. Object Pascal has this. Well, a kind of this idea, but works (almost) perfectly. For "garbage

Re: [fpc-pascal] ppcjvm issues

2017-01-29 Thread Lars
On Fri, January 27, 2017 10:52 am, Jon Foster wrote: > > On 01/27/2017 06:36 AM, Dmitry Boyarintsev wrote: > >> On Tue, Jan 10, 2017 at 6:14 AM, Michael Schnell > > wrote: >> >> >> >> If destroying an object is not necessary, the class should

Re: [fpc-pascal] ppcjvm issues

2017-01-29 Thread Lars
On Fri, January 27, 2017 11:37 am, Dmitry Boyarintsev wrote: > On Fri, Jan 27, 2017 at 12:52 PM, Jon Foster > > wrote: > > >> Correct me if I'm wrong: It would seem like that your free >> implementation >>> doesn't actually do anything, other than fulfilling the

Re: [fpc-pascal] ppcjvm issues

2017-01-27 Thread Jonas Maebe
On 27/01/17 22:18, Dmitry Boyarintsev wrote: How about moving "nil"-ing of the reference into default FreeInstance for JVM target? FreeInstance is a regular instance method. Instance methods cannot nil the self pointer (well, they can, but that will just nil the local copy of the

Re: [fpc-pascal] ppcjvm issues

2017-01-27 Thread Dmitry Boyarintsev
On Fri, Jan 27, 2017 at 1:41 PM, Jonas Maebe wrote: > It is defined as "if the instance is not nil, then it calls the destroy > method, and next it calls FreeInstance". You could override FreeInstance to > not free memory on any platform. > > However, if JVM free method

Re: [fpc-pascal] ppcjvm issues

2017-01-27 Thread Jonas Maebe
On 27/01/17 19:37, Dmitry Boyarintsev wrote: Object Pascal semantic of calling .Free suggests that "o" would no longer be a valid object. If a dummy Free method is available for JVM, then such semantic is violated. Calling Free is not defined as "any further access to this object must now

Re: [fpc-pascal] ppcjvm issues

2017-01-27 Thread Dmitry Boyarintsev
On Fri, Jan 27, 2017 at 12:52 PM, Jon Foster wrote: > Correct me if I'm wrong: It would seem like that your free implementation >> doesn't actually do anything, other than fulfilling the obligation of >> having a "free". If I do this: >> > > var > o: TObject; >

Re: [fpc-pascal] ppcjvm issues

2017-01-27 Thread Jon Foster
On 01/27/2017 08:48 AM, Jonas Maebe wrote: On 27/01/17 02:31, Jon Foster wrote: But any classes defined in Pascal provide those methods, if they descend from the default TObject. I think I read somewhere that classes can be defined that descend from the base Java class but I haven't done it.

Re: [fpc-pascal] ppcjvm issues

2017-01-27 Thread Jon Foster
On 01/27/2017 06:36 AM, Dmitry Boyarintsev wrote: On Tue, Jan 10, 2017 at 6:14 AM, Michael Schnell > wrote: If destroying an object is not necessary, the class should provide a dummy Free procedure. So the application programmer always

Re: [fpc-pascal] ppcjvm issues

2017-01-27 Thread Jonas Maebe
On 27/01/17 02:31, Jon Foster wrote: But any classes defined in Pascal provide those methods, if they descend from the default TObject. I think I read somewhere that classes can be defined that descend from the base Java class but I haven't done it. All classes on the JVM descend from a Java

Re: [fpc-pascal] ppcjvm issues

2017-01-27 Thread Dmitry Boyarintsev
On Tue, Jan 10, 2017 at 6:14 AM, Michael Schnell wrote: > > If destroying an object is not necessary, the class should provide a dummy > Free procedure. So the application programmer always can/should use Free. > > Why dummy? if it should be like this procedure TObject.Free;

Re: [fpc-pascal] ppcjvm issues

2017-01-26 Thread Jon Foster
On 01/26/2017 01:30 PM, Jon Foster wrote: On 01/18/2017 01:16 AM, Michael Schnell wrote: On 17.01.2017 19:07, Lars wrote: If you have a jvm project with lots of code and now want to start using this code in another regular mode objfpc unix/win32 application... Exactly this as the point I

Re: [fpc-pascal] ppcjvm issues

2017-01-26 Thread Jon Foster
On 01/18/2017 01:16 AM, Michael Schnell wrote: On 17.01.2017 19:07, Lars wrote: If you have a jvm project with lots of code and now want to start using this code in another regular mode objfpc unix/win32 application... Exactly this as the point I wanted to express. Even when coding an fpc

Re: [fpc-pascal] ppcjvm issues

2017-01-19 Thread Michael Schnell
On 17.01.2017 19:07, Lars wrote: If you have a jvm project with lots of code and now want to start using this code in another regular mode objfpc unix/win32 application... Exactly this as the point I wanted to express. Even when coding an fpc application or library for use with jvm, free (and

Re: [fpc-pascal] ppcjvm issues

2017-01-17 Thread wkitty42
On 01/17/2017 01:07 PM, Lars wrote: i.e. if you have a fake free procedure that can be called, then why program in garbage collection in the first place.. can you not IFDEF it so that it does actual work in a non-garbage collecting environment? seems to be the obvious answer there... --

Re: [fpc-pascal] ppcjvm issues

2017-01-17 Thread Lars
On Mon, January 16, 2017 2:40 am, Michael Schnell wrote: > On 14.01.2017 20:36, Lars wrote: > >> What if you are porting code to a non jvm... if you copy and paste >> something and it has no free, you're screwed. > Sorry. I don't understand. AFAIK, in a non jvm project, free() always is > provided

Re: [fpc-pascal] ppcjvm issues

2017-01-16 Thread Michael Schnell
On 14.01.2017 20:36, Lars wrote: What if you are porting code to a non jvm... if you copy and paste something and it has no free, you're screwed. Sorry. I don't understand. AFAIK, in a non jvm project, free() always is provided (and used). i.e. say you have some JVM algorithms that now need to

Re: [fpc-pascal] ppcjvm issues

2017-01-14 Thread Lars
On Thu, January 12, 2017 2:08 am, Michael Schnell wrote: > On 11.01.2017 11:25, Sven Barth wrote: > >> >> We're talking about JVM here where garbage collections *must* be used. >> So FPC does as well for that target. >> >> > This of course is true. But if the class code is in fpc, fpc paradigms >

Re: [fpc-pascal] ppcjvm issues

2017-01-12 Thread Michael Schnell
On 11.01.2017 11:25, Sven Barth wrote: We're talking about JVM here where garbage collections *must* be used. So FPC does as well for that target. This of course is true. But if the class code is in fpc, fpc paradigms should be adhered, as well. and here the fpc code *can* e.g. explicitly

Re: [fpc-pascal] ppcjvm issues

2017-01-11 Thread Jon Foster
On 01/11/2017 02:25 AM, Sven Barth wrote: Am 11.01.2017 08:54 schrieb "Michael Schnell" >: > > On 10.01.2017 05:13, Jon Foster wrote: >> >> On 01/07/2017 10:39 AM, leledumbo wrote: >> >> So that leaves me with the question: What about

Re: [fpc-pascal] ppcjvm issues

2017-01-11 Thread Sven Barth
Am 11.01.2017 08:54 schrieb "Michael Schnell" : > > On 10.01.2017 05:13, Jon Foster wrote: >> >> On 01/07/2017 10:39 AM, leledumbo wrote: >> >> So that leaves me with the question: What about destructors? Must I call free/destroy on all objects I create, or do they

Re: [fpc-pascal] ppcjvm issues

2017-01-10 Thread Michael Schnell
On 10.01.2017 05:13, Jon Foster wrote: On 01/07/2017 10:39 AM, leledumbo wrote: So that leaves me with the question: What about destructors? Must I call free/destroy on all objects I create, or do they self-destruct? If so destroy or free? AFAIU, in fpc destroying any objects is mandatory.

Re: [fpc-pascal] ppcjvm issues

2017-01-10 Thread Sven Barth
Am 10.01.2017 06:06 schrieb "Jon Foster" : > What I don't quite get from your example is using "self" as the second argument to setPositiveButton() & setNegativeButton. That parameter is asking for an OnClickListener() class. When I tried that I received a compile

Re: [fpc-pascal] ppcjvm issues

2017-01-09 Thread Jon Foster
On 01/08/2017 02:57 AM, Sven Barth wrote: On 07.01.2017 03:12, Jon Foster wrote: I've been working on building an app for Android using the FPC's JVM target. I'm using fpc 3.0.0. I've run into a couple of things that I'm not sure if they're bugs or I just don't know what I'm doing. I was using

Re: [fpc-pascal] ppcjvm issues

2017-01-09 Thread Jon Foster
On 01/07/2017 10:39 AM, leledumbo wrote: The first issue I ran into is this: procedure Cppp1Activity.onResume; begin inherited onResume; with AAAlertDialog.InnerBuilder(self) do begin setTitle(R.strings.app_name); end; end; I don't check by running the code

Re: [fpc-pascal] ppcjvm issues

2017-01-08 Thread Sven Barth
On 07.01.2017 03:12, Jon Foster wrote: > I've been working on building an app for Android using the FPC's JVM > target. I'm using fpc 3.0.0. I've run into a couple of things that I'm > not sure if they're bugs or I just don't know what I'm doing. I was > using fpc to avoid having to learn Java and

Re: [fpc-pascal] ppcjvm issues

2017-01-07 Thread Lars
On Sat, January 7, 2017 10:09 am, Jon Foster wrote: > On 01/07/2017 03:06 AM, Tomas Hajny wrote: > >> On Sat, January 7, 2017 03:12, Jon Foster wrote: >> >> >> >> Hello, >> >> >> You didn't mention that you weren't subscribed to the list, but since >> this seemed to be the case, I included your

Re: [fpc-pascal] ppcjvm issues

2017-01-07 Thread Jon Foster
On 01/07/2017 03:06 AM, Tomas Hajny wrote: On Sat, January 7, 2017 03:12, Jon Foster wrote: Hello, You didn't mention that you weren't subscribed to the list, but since this seemed to be the case, I included your address in Cc:. Thanks for this. I get a lot of mail from the FPC lists ... but

Re: [fpc-pascal] ppcjvm issues

2017-01-07 Thread leledumbo
> The first issue I ran into is this: > > procedure Cppp1Activity.onResume; > begin > inherited onResume; > with AAAlertDialog.InnerBuilder(self) do begin > setTitle(R.strings.app_name); > end; > end; I don't check by running the code directly, but looking at the

Re: [fpc-pascal] ppcjvm issues

2017-01-07 Thread Bart
On 1/7/17, Tomas Hajny wrote: > I can't comment the first part, but where exactly is a type named "float" > defined in FPC (which unit)? Float is defined in math unit. It is an alias to float128, if that type exists, else extende, or else to double, or else to single. Bart

Re: [fpc-pascal] ppcjvm issues

2017-01-07 Thread Tomas Hajny
On Sat, January 7, 2017 03:12, Jon Foster wrote: Hello, You didn't mention that you weren't subscribed to the list, but since this seemed to be the case, I included your address in Cc:. . . > The second issue I ran into: > > function f(x, y: integer): float; > begin >