Is there some disadvantages using mode Delphi?

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Is there some disadvantages using mode Delphi?

Marcos Douglas B. Santos
Hi,

I would like to write some packages that should work in FPC and Delphi.
I know that I will need to use {mode delphi} to do that.

My ask is: Is there some disadvantages using this mode?

I mean, is there something that we only can do in mode objfpc but not in mode delphi, or is it just about syntax?

Best regards,
Marcos Douglas

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Is there some disadvantages using mode Delphi?

Michael Van Canneyt


On Sat, 29 Apr 2017, Marcos Douglas B. Santos wrote:

> Hi,
>
> I would like to write some packages that should work in FPC and Delphi.
> I know that I will need to use {mode delphi} to do that.
>
> My ask is: Is there some disadvantages using this mode?
>
> I mean, is there something that we only can do in mode objfpc but not in
> mode delphi, or is it just about syntax?

It is not just about syntax. In ObjFPC mode, the compiler is more strict.
(for examlpe: no method parameter names that concide with properties of the object)

Michael.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Is there some disadvantages using mode Delphi?

Marcos Douglas B. Santos

On Sat, Apr 29, 2017 at 2:10 PM, Michael Van Canneyt <[hidden email]> wrote:

Hi,

I would like to write some packages that should work in FPC and Delphi.
I know that I will need to use {mode delphi} to do that.

My ask is: Is there some disadvantages using this mode?

I mean, is there something that we only can do in mode objfpc but not in
mode delphi, or is it just about syntax?

It is not just about syntax. In ObjFPC mode, the compiler is more strict.
(for examlpe: no method parameter names that concide with properties of the object)
Hmm, right (in fact I like this feature).
So, it is about syntax and strict.

But is there something that I can't do with mode delphi but I can using mode objfpc?
Let me rephrase: Is there some (new cool) feature that only works in mode objfpc?

My concern is make my code cross between FPC and Delphi, but loosing some feature that exists only in FPC.
I would like to know if worth make my code compilable between FPC/Lazarus and Delphi, even if my priority is FPC.


Marcos Douglas



_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Is there some disadvantages using mode Delphi?

Marco van de Voort
In reply to this post by Marcos Douglas B. Santos
In our previous episode, Marcos Douglas B. Santos said:
> I would like to write some packages that should work in FPC and Delphi.
> I know that I will need to use {mode delphi} to do that.
>
> My ask is: Is there some disadvantages using this mode?
>
> I mean, is there something that we only can do in mode objfpc but not in
> mode delphi, or is it just about syntax?

Mostly syntax. Mode objfpc disambiguates a corner case for procedural types
with an extra @ for assignment of procedural types, and a few other
tightenings.

The proponents of mode objfpc make a big deal out of the differences, but
IMHO it is mostly nitpicking. And worse unnecesarily incompatible
nitpicking.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Is there some disadvantages using mode Delphi?

Marcos Douglas B. Santos
On Sat, Apr 29, 2017 at 5:23 PM, Marco van de Voort <[hidden email]> wrote:

>
> In our previous episode, Marcos Douglas B. Santos said:
> > I would like to write some packages that should work in FPC and Delphi.
> > I know that I will need to use {mode delphi} to do that.
> >
> > My ask is: Is there some disadvantages using this mode?
> >
> > I mean, is there something that we only can do in mode objfpc but not in
> > mode delphi, or is it just about syntax?
>
> Mostly syntax. Mode objfpc disambiguates a corner case for procedural types
> with an extra @ for assignment of procedural types, and a few other
> tightenings.
>
> The proponents of mode objfpc make a big deal out of the differences, but
> IMHO it is mostly nitpicking. And worse unnecesarily incompatible
> nitpicking.

Good to know.
I remembered something right now: Is there some problem when units
mode objfpc have "communication" with units using mode delphi about
Unicode?

If I remember well, PChar and even String is different between these
modes, right? The compiler will convert strings between them or this
is not a problem? Even using LCL?
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Is there some disadvantages using mode Delphi?

Free Pascal - General mailing list
In reply to this post by Marcos Douglas B. Santos

Am 29.04.2017 22:19 schrieb "Marcos Douglas B. Santos" <[hidden email]>:
>
>
> On Sat, Apr 29, 2017 at 2:10 PM, Michael Van Canneyt <[hidden email]> wrote:
>>
>>
>>> Hi,
>>>
>>> I would like to write some packages that should work in FPC and Delphi.
>>> I know that I will need to use {mode delphi} to do that.
>>>
>>> My ask is: Is there some disadvantages using this mode?
>>>
>>> I mean, is there something that we only can do in mode objfpc but not in
>>> mode delphi, or is it just about syntax?
>>
>>
>> It is not just about syntax. In ObjFPC mode, the compiler is more strict.
>> (for examlpe: no method parameter names that concide with properties of the object)
>
> Hmm, right (in fact I like this feature).
> So, it is about syntax and strict.
>
> But is there something that I can't do with mode delphi but I can using mode objfpc?
> Let me rephrase: Is there some (new cool) feature that only works in mode objfpc?

The only thing comes to mind would be complex expressions containing inline specializations of generics. Due to the Delphi modes not using the "generic" and "specialize" keywords there is some disambigity that the compiler is not yet able to handle (most of these cases can however be worked around either by explicitly declaring the specializations as types or breaking the expressions up into simpler ones).

Regards,
Sven


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Is there some disadvantages using mode Delphi?

Free Pascal - General mailing list
In reply to this post by Marcos Douglas B. Santos

Am 29.04.2017 23:56 schrieb "Marcos Douglas B. Santos" <[hidden email]>:
>
> On Sat, Apr 29, 2017 at 5:23 PM, Marco van de Voort <[hidden email]> wrote:
> >
> > In our previous episode, Marcos Douglas B. Santos said:
> > > I would like to write some packages that should work in FPC and Delphi.
> > > I know that I will need to use {mode delphi} to do that.
> > >
> > > My ask is: Is there some disadvantages using this mode?
> > >
> > > I mean, is there something that we only can do in mode objfpc but not in
> > > mode delphi, or is it just about syntax?
> >
> > Mostly syntax. Mode objfpc disambiguates a corner case for procedural types
> > with an extra @ for assignment of procedural types, and a few other
> > tightenings.
> >
> > The proponents of mode objfpc make a big deal out of the differences, but
> > IMHO it is mostly nitpicking. And worse unnecesarily incompatible
> > nitpicking.
>
> Good to know.
> I remembered something right now: Is there some problem when units
> mode objfpc have "communication" with units using mode delphi about
> Unicode?
>
> If I remember well, PChar and even String is different between these
> modes, right? The compiler will convert strings between them or this
> is not a problem? Even using LCL?

The default string type depends on two different things, namely the mode and the H switch which is by default only set in the Delphi modes. H- means that "String" is "ShortString". H+ means that "String" is "AnsiString" as long as modeswitch UnicodeString is not set (which is for example the case if the mode is DelphiUnicode). However since the latter isn't really recommended yet anyway (since the RTL and especially its classes would still mainly use String=AnsiString) you shouldn't really run into problems there.
The same is true for (P)Char: only if modeswitch UnicodeString is set, then it's an alias for (P)WideChar, otherwise it's an alias for (P)AnsiChar.
At least the conversions between the string types are handled by the compiler, only PAnsiChar <=> PWideChar conversions you'd need to do yourself, but the compiler would complain there anyway.

Regards,
Sven


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Is there some disadvantages using mode Delphi?

Marcos Douglas B. Santos
On Sat, Apr 29, 2017 at 7:21 PM, Sven Barth via fpc-pascal
<[hidden email]> wrote:

>> If I remember well, PChar and even String is different between these
>> modes, right? The compiler will convert strings between them or this
>> is not a problem? Even using LCL?
>
> The default string type depends on two different things, namely the mode and
> the H switch which is by default only set in the Delphi modes. H- means that
> "String" is "ShortString". H+ means that "String" is "AnsiString" as long as
> modeswitch UnicodeString is not set (which is for example the case if the
> mode is DelphiUnicode). However since the latter isn't really recommended
> yet anyway (since the RTL and especially its classes would still mainly use
> String=AnsiString) you shouldn't really run into problems there.
> The same is true for (P)Char: only if modeswitch UnicodeString is set, then
> it's an alias for (P)WideChar, otherwise it's an alias for (P)AnsiChar.
> At least the conversions between the string types are handled by the
> compiler, only PAnsiChar <=> PWideChar conversions you'd need to do
> yourself, but the compiler would complain there anyway.

Sven, thank you for this explanation.
Well, I will try.

About generics, I'm not using them (yet) so, I won't have problems.

Regards,
Marcos Douglas
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Is there some disadvantages using mode Delphi?

Graeme Geldenhuys-6
In reply to this post by Marcos Douglas B. Santos
On 2017-04-29 21:18, Marcos Douglas B. Santos wrote:
> My concern is make my code cross between FPC and Delphi, but loosing some
> feature that exists only in FPC.

My question is, why do you need Delphi at all? FPC can target more
platforms that Delphi, support is better, bugs actually get fixed, and
the price of FPC is great. ;-) By only using FPC you can also use the
much love (by many) ObjFPC mode.

Regards,
  Graeme

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Is there some disadvantages using mode Delphi?

Graeme Geldenhuys-6
In reply to this post by Marco van de Voort
On 2017-04-29 21:23, Marco van de Voort wrote:
> The proponents of mode objfpc make a big deal out of the differences, but
> IMHO it is mostly nitpicking. And worse unnecesarily incompatible
> nitpicking.

For many Delphi is simply not needed, so why would anybody then opt for
something other than mode ObjFPC. The objfpc syntax rules make more
sense to me, so I consider the more "strict" compiler as a good thing.

Regards,
  Graeme

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Is there some disadvantages using mode Delphi?

Marcos Douglas B. Santos
In reply to this post by Graeme Geldenhuys-6
On Sat, Apr 29, 2017 at 10:37 PM, Graeme Geldenhuys
<[hidden email]> wrote:
> On 2017-04-29 21:18, Marcos Douglas B. Santos wrote:
>> My concern is make my code cross between FPC and Delphi, but loosing some
>> feature that exists only in FPC.
>
> My question is, why do you need Delphi at all? FPC can target more
> platforms that Delphi, support is better, bugs actually get fixed, and
> the price of FPC is great. ;-) By only using FPC you can also use the
> much love (by many) ObjFPC mode.

My priority is FPC. I don't need Delphi, it is just a bonus.
I made some packages and some people would like to use on Delphi.

Regards,
Marcos Douglas
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal