[fpc-pascal] ppcjvm issues

Jon Foster jon-lists at jfpossibilities.com
Fri Jan 27 19:04:28 CET 2017


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.
>
> All classes on the JVM descend from a Java class. The Java Runtime does 
> not support classes that don't descend directly or indirectly from 
> java.lang.Object.
Yes, BUT: TObject is provided by the "system" unit in FPC and although it 
descends from JLObject it provides basic FPC like semantics, including 
free/destroy. FPC treats " TMyClass = class ..." just like it does in the 
native code versions and TMyClass would descend from TObject inheriting its 
methods. So unless you tried to create a class which directly descended 
from JLObject, instead of TObject you inherit "free" and "destroy", so you 
can call them as you usually would.

Other than missing unit functionality I've found the JVM implementation 
makes Java seem very Pascal like. The devs have done a splendid job IMO. It 
did take me a while to find the Java lib equivalent of StrToInt. :-D

-Jon

-- 
Jon Foster
JF Possibilities, Inc.




More information about the fpc-pascal mailing list