Re: [fpc-pascal] Feature announcement: default namespaces

2018-05-08 Thread Graeme Geldenhuys
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  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Feature announcement: default namespaces

2018-05-07 Thread Mattias Gaertner
On Mon, 7 May 2018 21:49:26 +0200
Sven Barth via fpc-pascal  wrote:

> Am 07.05.2018 um 10:35 schrieb Mattias Gaertner:
> >> [...]
> >> The compiler is told about a default namespace using the new -FN
> >> 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  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Feature announcement: default namespaces

2018-05-07 Thread Sven Barth via fpc-pascal

Am 07.05.2018 um 10:35 schrieb Mattias Gaertner:

[...]
The compiler is told about a default namespace using the new -FN
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  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Feature announcement: default namespaces

2018-05-07 Thread Sven Barth via fpc-pascal
Marco van de Voort  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  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Feature announcement: default namespaces

2018-05-07 Thread Marco van de Voort
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  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Feature announcement: default namespaces

2018-05-07 Thread Sven Barth via fpc-pascal
Mattias Gaertner  schrieb am Mo., 7. Mai 2018,
10:35:

> On Sat, 5 May 2018 19:23:04 +0200
> Sven Barth via fpc-pascal  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
> > 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  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Feature announcement: default namespaces

2018-05-07 Thread Mattias Gaertner
On Sat, 5 May 2018 19:23:04 +0200
Sven Barth via fpc-pascal  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 
> 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  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Feature announcement: default namespaces

2018-05-06 Thread Sven Barth via fpc-pascal

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  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Feature announcement: default namespaces

2018-05-06 Thread Marcos Douglas B. Santos
On Sun, May 6, 2018 at 10:45 AM, Vojtěch Čihák  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  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Feature announcement: default namespaces

2018-05-06 Thread Vojtěch Čihák

i,
 
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.). 
 
V.
__

Od: "Marcos Douglas B. Santos" <m...@delfire.net>
Komu: FPC-Pascal users discussions <fpc-pascal@lists.freepascal.org>
Datum: 06.05.2018 15:34
Předmět: Re: [fpc-pascal] Feature announcement: default namespaces


On Sun, May 6, 2018 at 4:40 AM, Sven Barth via fpc-pascal
<fpc-pascal@lists.freepascal.org> 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...
However, Lazarus could do that — we just need a replace in the code.

By the way, good work!

Best,
Marcos Douglas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal 
<http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Feature announcement: default namespaces

2018-05-06 Thread Marcos Douglas B. Santos
On Sun, May 6, 2018 at 4:40 AM, Sven Barth via fpc-pascal
 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...
However, Lazarus could do that — we just need a replace in the code.

By the way, good work!

Best,
Marcos Douglas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Feature announcement: default namespaces

2018-05-06 Thread Marco van de Voort
In our previous episode, Sven Barth via fpc-pascal said:
> 
> In FPC we currently don't use dotted unit names much, but maybe that will
> change in the future.

Afaik  FV and LCL have conflicts.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Feature announcement: default namespaces

2018-05-06 Thread Marco van de Voort
In our previous episode, Mattias Gaertner said:
> He meant:
> If you use units with namespaces and you can't use the -FN option, then
> it becomes cumbersome to write them. Then a unit directive would be
> nice to have.

Yes, but both the directive and the uses would be a modification anyway.

I can imagine that if you have an includefile with defines, that it is
iuseful.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Feature announcement: default namespaces

2018-05-06 Thread Ryan Joseph


> On May 6, 2018, at 2:40 PM, Sven Barth via fpc-pascal 
>  wrote:
> 
> The namespaces in Object Pascal are merely a convenience thing. E.g. Delphi 
> prefixed many of the existing units (like SysUtils became System.SysUtils, 
> Windows became WinApi.Windows and Forms became VCL.Forms (or so)). They did 
> this so that FireMonkey units can share unit names with the VCL (e.g. 
> FMX.Forms). But to keep backwards compatibility with old code Delphi projects 
> have by default their default namespace list set to something like "System, 
> WinApi, VCL" so that such code continues to compile. 
> 

So I could use this feature if I used dotted file names like Utils.Foo.pas? I 
never thought of doing that before so this is al news to me. 

Regards,
Ryan Joseph

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Feature announcement: default namespaces

2018-05-06 Thread Sven Barth via fpc-pascal
Tomas Hajny  schrieb am Sa., 5. Mai 2018, 19:52:

> 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.
>

Then that's something I'll have to add then as well ;)

>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Feature announcement: default namespaces

2018-05-06 Thread Sven Barth via fpc-pascal
Ryan Joseph  schrieb am So., 6. Mai 2018, 09:16:

>
>
> > On May 6, 2018, at 1:46 PM, Mattias Gaertner 
> wrote:
> >
> > He meant:
> > If you use units with namespaces and you can't use the -FN option, then
> > it becomes cumbersome to write them. Then a unit directive would be
> > nice to have.
>
> But does FPC have actual namespaces besides prefixing unit names? What
> exactly are "units with namespaces”?
>

They are also named "dotted units" and as I wrote in y announcement mail
Object Pascal doesn't have namespaces in the sense of languages like C#,
C++ or Java that allow for deep hierarchies and such.
The namespaces in Object Pascal are merely a convenience thing. E.g. Delphi
prefixed many of the existing units (like SysUtils became System.SysUtils,
Windows became WinApi.Windows and Forms became VCL.Forms (or so)). They did
this so that FireMonkey units can share unit names with the VCL (e.g.
FMX.Forms). But to keep backwards compatibility with old code Delphi
projects have by default their default namespace list set to something like
"System, WinApi, VCL" so that such code continues to compile.

In FPC we currently don't use dotted unit names much, but maybe that will
change in the future.

Regards,
Sven

>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Feature announcement: default namespaces

2018-05-06 Thread Sven Barth via fpc-pascal
Ben Grasset  schrieb am So., 6. Mai 2018, 03:16:

> Cool I guess. Kind of seems not very important at all though. FPC lacks
> compatibility with current Delphi in various other far more significant
> areas...
>

It was something that was relatively easy to implement and what some people
complained about that we don't have.
Also pas2js already implemented it which bothered me a bit :P

Regards,
Sven
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Feature announcement: default namespaces

2018-05-06 Thread Ryan Joseph


> On May 6, 2018, at 1:46 PM, Mattias Gaertner  
> wrote:
> 
> He meant:
> If you use units with namespaces and you can't use the -FN option, then
> it becomes cumbersome to write them. Then a unit directive would be
> nice to have.

But does FPC have actual namespaces besides prefixing unit names? What exactly 
are "units with namespaces”?

Regards,
Ryan Joseph

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Feature announcement: default namespaces

2018-05-06 Thread Mattias Gaertner
On Sun, 6 May 2018 09:11:23 +0700
Ryan Joseph  wrote:

> > On May 6, 2018, at 12:23 AM, Sven Barth via fpc-pascal 
> >  wrote:
> > 
> > For some users it might be cumbersome however to write the complete names 
> > (even though their IDE of choice might support them here) or maybe they 
> > have different sets of units with same names and interfaces, but different 
> > namespaces (e.g. ProductX and ProductY which contain wrappers units for the 
> > 3rd party products X and Y with a common interface). Of course in the 
> > latter case these can be switched using ifdefs or some creative usage of 
> > macros, but that can be done simpler.  
> 
> I don’t understand what this is for because “namespaces” in FPC are optional 
> anyways right? I’ve only used them to resolve name conflicts but if they’re 
> optional then doesn’t that implicitly imply they're default also? Maybe a 
> concrete example would help to explain.

He meant:
If you use units with namespaces and you can't use the -FN option, then
it becomes cumbersome to write them. Then a unit directive would be
nice to have.

Mattias
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Feature announcement: default namespaces

2018-05-05 Thread Ryan Joseph


> On May 6, 2018, at 12:23 AM, Sven Barth via fpc-pascal 
>  wrote:
> 
> For some users it might be cumbersome however to write the complete names 
> (even though their IDE of choice might support them here) or maybe they have 
> different sets of units with same names and interfaces, but different 
> namespaces (e.g. ProductX and ProductY which contain wrappers units for the 
> 3rd party products X and Y with a common interface). Of course in the latter 
> case these can be switched using ifdefs or some creative usage of macros, but 
> that can be done simpler.

I don’t understand what this is for because “namespaces” in FPC are optional 
anyways right? I’ve only used them to resolve name conflicts but if they’re 
optional then doesn’t that implicitly imply they're default also? Maybe a 
concrete example would help to explain.

Regards,
Ryan Joseph

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Feature announcement: default namespaces

2018-05-05 Thread Ben Grasset
Cool I guess. Kind of seems not very important at all though. FPC lacks
compatibility with current Delphi in various other far more significant
areas...


Virus-free.
www.avast.com

<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Feature announcement: default namespaces

2018-05-05 Thread Sven Barth via fpc-pascal
Michael Van Canneyt  schrieb am Sa., 5. Mai 2018,
21:24:

>
>
> On Sat, 5 May 2018, Sven Barth via fpc-pascal wrote:
>
> > Hello together!
> >
> > I'm pleased to announce the implementation of a new feature: default
> > namespaces.
>
> Great !! Nice job, Sven :)
>
> > Enter default namespaces.
> >
> > The compiler is told about a default namespace using the new -FN
> > parameter, whereby  is a valid Pascal identifier for a namespace
> > (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.
>
> All looks logical to me. One question only:
>
> Is there a reason you didn't implement a global directive:
>
> {$NAMESPACE somens}
>
> or is this still planned ?
>

Does Delphi support this? If not, that is your answer: no real need for it
(fair remark: I'm currently freshly home from a club and thus quite a bit
drunk).

Regards,
Sven

>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Feature announcement: default namespaces

2018-05-05 Thread Marco van de Voort
In our previous episode, Michael Van Canneyt said:
> >> or is this still planned ?
> >
> > How would this work anyway? Same problem like where to put a global $define
> > ?
> 
> Not sure what you mean ?
> 
> {$NAMESPACE FMX}
> 
> interface
> 
> uses controls; -> Resolves to FMX.Controls ?

I took global as program global. Seems you mean unit global. That is of
course not a problem.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Feature announcement: default namespaces

2018-05-05 Thread Michael Van Canneyt



On Sat, 5 May 2018, Marco van de Voort wrote:


In our previous episode, Michael Van Canneyt said:

Is there a reason you didn't implement a global directive:

{$NAMESPACE somens}

or is this still planned ?


How would this work anyway? Same problem like where to put a global $define
?


Not sure what you mean ?

{$NAMESPACE FMX}

interface

uses controls; -> Resolves to FMX.Controls ?


Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Feature announcement: default namespaces

2018-05-05 Thread Marco van de Voort
In our previous episode, Michael Van Canneyt said:
> Is there a reason you didn't implement a global directive:
> 
> {$NAMESPACE somens}
> 
> or is this still planned ?

How would this work anyway? Same problem like where to put a global $define
?

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Feature announcement: default namespaces

2018-05-05 Thread Michael Van Canneyt



On Sat, 5 May 2018, Sven Barth via fpc-pascal wrote:


Hello together!

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


Great !! Nice job, Sven :)


Enter default namespaces.

The compiler is told about a default namespace using the new -FN 
parameter, whereby  is a valid Pascal identifier for a namespace 
(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.


All looks logical to me. One question only:

Is there a reason you didn't implement a global directive:

{$NAMESPACE somens}

or is this still planned ?

Regardless of the answer: Congratulations on a nice job :)

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Feature announcement: default namespaces

2018-05-05 Thread 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.

Tomas


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal