Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Delphi and Object Pascal in FPC?

  1. #1
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    Delphi and Object Pascal in FPC?

    I'm just wondering... there is a Delphi Mode for the FPC, but is this a required mode to support Object Pascal?

    And how does one define what dialect of the language is supported or are all dialects supported by default depending on your code? If so, how is that determined?

    Being as Object Pascal is it's own standard, dispite what Borland seems to think and no matter how confused the general public gets, Free Pascal does support it in this respect, but how much and how?

    A question I think that is often passed over for more Delphi/Borland-esk type tainted questions that only confuse the point.
    Jason McMillen
    Pascal Game Development
    Co-Founder





  2. #2

    Delphi and Object Pascal in FPC?

    Delphi is an Object Pascal dialect if i'm right. FreePascal supports Object Pascal by default but if you want to use Delphi additions (such as Result is, if i'm right) you should set the mode to Delphi.

    You can also set other dialects such as Mac Pascal, Turbo pascal, GNU pascal. You should use the compiler derective $mode for it.

  3. #3
    Legendary Member cairnswm's Avatar
    Join Date
    Nov 2002
    Location
    Randburg, South Africa
    Posts
    1,537

    Delphi and Object Pascal in FPC?

    The Delphi mode is also needed to use the Delphi method of pointer hiding.
    William Cairns
    My Games: http://www.cairnsgames.co.za (Currently very inactive)
    MyOnline Games: http://TheGameDeveloper.co.za (Currently very inactive)

  4. #4
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    Delphi and Object Pascal in FPC?

    Well, Delphi is the IDE... many people follow Borland's (--or should we say Inprise's :evil BAD example and calls Object Pascal Delphi. WRONG!!!

    I'm sorry for those that actually believe that Borland did something so great and wonderful since Delphi was created and along with it a revamped dialect of Apple's version of the original language called Object Pascal, up until whatever version it was [size=9px](I think 5 or 6 since that was about when someone in management started with all this funny naming nonsense)[/size] that justifies renaming a language that had been called what is has been for so many years, simply because Borland had an identity crisis and forgot how to name things properly. :lol:

    It's sick really.


    Hmm... so is it fair to say that you cannot use Object Pascal unless you set 'Delphi Mode'? I'd opt that this Delphi Mode be changed to 'Object Pascal Mode'. Being as the mode's name will last longer, I think.

    I mean you could continue to follow in Borland's foot steps, but then again we'd have to come up with 20 different names for each port of Free Pascal just because it's running on a different platform. :lol:
    Jason McMillen
    Pascal Game Development
    Co-Founder





  5. #5
    Legendary Member cairnswm's Avatar
    Join Date
    Nov 2002
    Location
    Randburg, South Africa
    Posts
    1,537

    Delphi and Object Pascal in FPC?

    You can use Object Pascal in FPC without Delphi Mode. You cannot use Delphi Pascal in FPC unless you set the Delphi Mode On.

    Object Pascal requires you to manage pointers etc.

    [pascal]
    Item := ^OtherItem
    [/pascal]

    While Delphi Pascal hides these pointer activities from you

    [pascal]
    Item := OtherItem;
    [/pascal]

    Object Pascal handles Objects in a similar method to C++ - one of the big reasons I dislike C++ so much. Delphi Pascal understands that passing a pointer to an object to another object means you want to pass a reference to that object and not actually pass the address of the object pointer to the other object.

    This is the reason I like Delphi so much. The standard silly memory manageemnt mistakes are less likely as it already abstracts that away from the developer.

    PS. My understanding is that Delphi is a derivitive of the pascal language now. It is now considered its own language and is no Longer considered pure pascal. (Just like Oracle PL/SQL is no longer considered SQL but is its own dirivitive)
    William Cairns
    My Games: http://www.cairnsgames.co.za (Currently very inactive)
    MyOnline Games: http://TheGameDeveloper.co.za (Currently very inactive)

  6. #6

    Delphi and Object Pascal in FPC?

    Not so true, let me elaborate:

    Free Pascal supports atleast 5 dialects (Tp, Fpc, ObjFpc, Delphi, MacPas) maybe more, but I know only these.

    Fpc and TP dialects are NOT object oriented, they are old procedural style along with not-hiding pointers etc. Fpc dialect differes in that it allows later non-OOP additions like overloading operators etc.

    MacPas is a macintosh original dialect and I know nothing about it since I never even touched a mac

    ObjFpc and Delphi dialects ARE BOTH OBJECT ORIENTED. They are VERY common. In fact I bet you could make "auto-translators" for them in one day or so. Let me write the difference I know about:

    Both allow CLASSES AND OBJECTS. Both disallow mixing them together(ie assignment) because things like RTTI and VMT are different in them.

    Delphi mode is more restrictive for order of methods and variables in classes(members) like for example:

    TOne = class
    procedure One;
    x: integer; // error, this is impossible in delphi and delphi-mode fpc

    The above example is valid in objfpc mode.
    Delphi mode hides pointers as you sayed. This is NOT some hyper advanced feature. It's actualy a bad practice IMHO because it makes the code not-so-obvious.
    Objfpc requires explicit dereferencing.
    Delphi mode has limitations when it comes to array handling(perhaps it change IIRC delphi finaly added this functionality as of late). You couldn't make a pointer and use it directly as an array IE:

    var
    p: Pointer;
    p[2]:=something;

    This is valid in objfpc mode. ObjFpc also allows things specific for FPC which are not yet in delphi. Global properties, and other funky stuff, operator overloading etc.

    To sum it up the difference between ObjFpc and Delphi modes is that ObjFpc mode requires explicit dereference and adds FPC specific addons which are not in Delphi, while in turn Delphi mode is specific for staying compatible to Delphi and it's limitations. ObjFpc mode has limitations too like for example enforcing different names in classes and methods etc.(make your own opinion)
    Most important is tho they both are OOP in classes sense.

    I myself use ObjFPC mode since I don't plan to touch delphi (I work in FreeBSD/Linux and make things as cross-platform as possible so delphi is not an option)
    Using Delphi mode is good if you want to be compatible with delphi + if you don't need one of the more advanced features of free pascal.

    Hope this helps
    Feel the power of Open Source.
    <br />Feel the power of Free Pascal.

  7. #7
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    Delphi and Object Pascal in FPC?

    Hmm indeed it does. A lot actually. I think it might even have opened up some other eyes to the implimentation of Object Pascal in FPC.

    Thanks guys for your help!
    Jason McMillen
    Pascal Game Development
    Co-Founder





  8. #8

    ?

    Quote Originally Posted by Almindor
    Fpc and TP dialects are NOT object oriented
    How so? both Turbo Pascal and FPC support Objects; am i missing something?

  9. #9

    Delphi and Object Pascal in FPC?

    I ment Classes. You can use old style stack-based "object" in them but not classes.
    Feel the power of Open Source.
    <br />Feel the power of Free Pascal.

  10. #10

    Delphi and Object Pascal in FPC?

    Sometimes those "old-style stack-based objects" have their distinct advantages over the newer class types. For example, using one in local scope does not mean you have to have a call to allocate some memory to hold the class instance, with a try..finally statement to make sure it gets freed. You can also easily create an array of them. You can initialize that array to zero with one call to FillChar. And the list goes on. Borland call them deprecated. I call them useful.

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •