Feature announcement: default namespaces

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

Re: Feature announcement: default namespaces

Marcos Douglas B. Santos
On Sun, May 6, 2018 at 10:45 AM, Vojtěch Čihák <[hidden email]> wrote:
> i,
>
> LCLIntf, LCLProc, LCLType isn't enough? I will use dotted units only if
> there will be absolutely no other way around.

There are many others without LCL prefix...

> I believe it can be useful but I don't think it's "must have" (when I don't
> consider Delphi compat.).

I've said "would..." and "could..."

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: Feature announcement: default namespacesy

Marco van de Voort
In reply to this post by Marcos Douglas B. Santos
In our previous episode, Marcos Douglas B. Santos said:
> <[hidden email]> wrote:
> > [...]
> >
> > In FPC we currently don't use dotted unit names much, but maybe that will
> > change in the future.
>
> Would be good if all units could be prefixed to make a pattern, like
> `fpc.web, fpc.xml, ...` but I know that we need to maintain the
> compatibility with Delphi using the same names...

Yes. And you don't want to keep long lists of all prefixes that you want to
have, so I think it is more for exceptions where there are clashes than for
mass transition to this scheme. To be honest I always found it annoying in
Delphi, and use old names and prefixes as much as possible.

But it does resolves problems like Lazarus currently (afaik) not installing FV
because units conflict.

E.g. The conflicting units can get a prefix lcl. and
Lazarus automatically adds the prefix parameter for projects that use LCL.

Similarly for other packages that have very common names.

Only projects that really use both such packages will have to use the longer
form.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Feature announcement: default namespaces

Free Pascal - General mailing list
In reply to this post by Tomas Hajny-2
Am 05.05.2018 um 19:53 schrieb Tomas Hajny:

> On Sat, May 5, 2018 19:23, Sven Barth via fpc-pascal wrote:
>
>
> Hi Sven,
>
>   .
>   .
>> (e.g. "MyUnits" or "FCL.XML" or "FCL.Web.Base"). Like with all similar
>> -F parameters -FN only takes a single value, but can be specified
>> multiple times.
>   .
>   .
>
> I'm not sure what are 'all similar -F parameters', but many -F parameters
> allow multiple semicolon separated values.

Done in r38939. :)

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: Feature announcement: default namespaces

Mattias Gaertner
In reply to this post by Free Pascal - General mailing list
On Sat, 5 May 2018 19:23:04 +0200
Sven Barth via fpc-pascal <[hidden email]> wrote:

>[...]
> I'm pleased to announce the implementation of a new feature: default
> namespaces.

Nice!
Dotted unit names without that felt so stupid.

 
>[...] Nevertheless the prefix of such a unit (in my example "MyUnits") is called a namespace.

Fun fact: Delphi help sometimes calls it "unit scope names". ;)

 
>[...]
> The compiler is told about a default namespace using the new -FN<x>
> parameter,

Lazarus now checks for the -FN flag in the custom compiler options.

Can you add a message similar to "Using unit path:"?
Then Lazarus can find out what default namespaces are defined by the
fpc.cfg.


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

Re: Feature announcement: default namespaces

Free Pascal - General mailing list
Mattias Gaertner <[hidden email]> schrieb am Mo., 7. Mai 2018, 10:35:
On Sat, 5 May 2018 19:23:04 +0200
Sven Barth via fpc-pascal <[hidden email]> wrote:

>[...]
> I'm pleased to announce the implementation of a new feature: default
> namespaces.

Nice!
Dotted unit names without that felt so stupid.
So you are one of those that supported/wanted that feature :P

>[...] Nevertheless the prefix of such a unit (in my example "MyUnits") is called a namespace.

Fun fact: Delphi help sometimes calls it "unit scope names". ;)
Maybe we should use that terminology as well *shrugs*

>[...]
> The compiler is told about a default namespace using the new -FN<x>
> parameter,

Lazarus now checks for the -FN flag in the custom compiler options.

Can you add a message similar to "Using unit path:"?
Then Lazarus can find out what default namespaces are defined by the
fpc.cfg.

Can do that :) 

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: Feature announcement: default namespaces

Marco van de Voort
In reply to this post by Free Pascal - General mailing list
In our previous episode, Sven Barth via fpc-pascal said:
> >
> > I'm not sure what are 'all similar -F parameters', but many -F parameters
> > allow multiple semicolon separated values.
>
> Done in r38939. :)

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

Re: Feature announcement: default namespaces

Free Pascal - General mailing list
Marco van de Voort <[hidden email]> schrieb am Mo., 7. Mai 2018, 11:51:
In our previous episode, Sven Barth via fpc-pascal said:
> >
> > I'm not sure what are 'all similar -F parameters', but many -F parameters
> > allow multiple semicolon separated values.
>
> Done in r38939. :)

Delphi uses semicolons :-)

FPC's parameters need to be consistent with its other arguments. If none of the other arguments would have supported lists I wouldn't have introduced that just now. Also if the other arguments would have used "," I wouldn't have started to use ";" either. 
That said I personally prefer to not use these list forms of the arguments 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: Feature announcement: default namespaces

Free Pascal - General mailing list
In reply to this post by Mattias Gaertner
Am 07.05.2018 um 10:35 schrieb Mattias Gaertner:
>> [...]
>> The compiler is told about a default namespace using the new -FN<x>
>> parameter,
> Lazarus now checks for the -FN flag in the custom compiler options.
>
> Can you add a message similar to "Using unit path:"?
> Then Lazarus can find out what default namespaces are defined by the
> fpc.cfg.
Done in r38944. :)

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: Feature announcement: default namespaces

Mattias Gaertner
On Mon, 7 May 2018 21:49:26 +0200
Sven Barth via fpc-pascal <[hidden email]> wrote:

> Am 07.05.2018 um 10:35 schrieb Mattias Gaertner:
> >> [...]
> >> The compiler is told about a default namespace using the new -FN<x>
> >> parameter,  
> > Lazarus now checks for the -FN flag in the custom compiler options.
> >
> > Can you add a message similar to "Using unit path:"?
> > Then Lazarus can find out what default namespaces are defined by the
> > fpc.cfg.  
> Done in r38944. :)

Thanks! Appreciated.

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

Re: Feature announcement: default namespaces

Graeme Geldenhuys-6
In reply to this post by vojtech.cihak
On 2018-05-06 14:45, Vojtěch Čihák wrote:
> LCLIntf, LCLProc, LCLType isn't enough? I will use dotted units only if
> there will be absolutely no other way around.
>
> I believe it can be useful but I don't think it's "must have" (when I
> don't consider Delphi compat.). 
>

No, it's not a "must have" or "must use", but it does have it's uses. As
was already pointed out, Delphi uses it for backwards compatibility and
allows two completely different framework to use the same unit names.
eg: VCL.Forms and FMX.Forms.

It could be used in FPC or your own library too - instead of using
IFDEFs and Include files for platform specific code, where they share
the same interface. So now you can use namespaces instead and specify
the namespace platform when you compile - similar to what you would have
done with Compile Defines.


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
12