Recent

Author Topic: Struggling with a thing that can't be well summarized on this topic line  (Read 3631 times)

Gustavo 'Gus' Carreno

  • Hero Member
  • *****
  • Posts: 1090
  • Professional amateur ;-P
Hey Y'all,

Ok, here's the thing: I've started this repository on GitHub so I could have a spin on 2 Markdown libs that I found.

Those libs are:

And if you look at the progress made, reflected by the current state of the app, I've been able to put 2 libs, side by side and test them.

Now, here comes the icky, complicated part:

I've found that someone as forked delphi-markdown and decided to call it fpc-markdown.

Since delphi-markdown and fpc-mardown have the same named units, my questions is:

How can I test them on the same program?
How can I pick up on namespacing, if there even is a distinction?
Can having them installed has packages help, instead of just adding the sources to the Project Options?

Many thanks in advance!!

Cheers,
Gus
Lazarus 3.99(main) FPC 3.3.1(main) Ubuntu 23.10 64b Dark Theme
Lazarus 3.0.0(stable) FPC 3.2.2(stable) Ubuntu 23.10 64b Dark Theme
http://github.com/gcarreno

Gustavo 'Gus' Carreno

  • Hero Member
  • *****
  • Posts: 1090
  • Professional amateur ;-P
Re: Struggling with a thing that can't be well summarized on this topic line
« Reply #1 on: September 13, 2021, 01:36:33 pm »
Hey Y'all,

Can no one give me the slightest hint?

Even a simple: It's completely impossible, would be better than nothing?

Where's the helping spirit I've participated in and have lauded myself, hein peeps?

Cheers,
Gus
Lazarus 3.99(main) FPC 3.3.1(main) Ubuntu 23.10 64b Dark Theme
Lazarus 3.0.0(stable) FPC 3.2.2(stable) Ubuntu 23.10 64b Dark Theme
http://github.com/gcarreno

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9754
  • Debugger - SynEdit - and more
    • wiki
Re: How to resolve unit name conflicts across packages
« Reply #2 on: September 13, 2021, 01:49:37 pm »
There were some mails/messages about namespaces (dotted unitnames) in fpc.
At least fpc trunk must already have that. Maybe 3.2 too.

I have not yet myself looked into it.

There may be switches to compile an entire package with a prefix.... (no idea)

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11352
  • FPC developer.
Re: Struggling with a thing that can't be well summarized on this topic line
« Reply #3 on: September 13, 2021, 03:31:04 pm »
Afaik

  • 3.0+ supports files with dotted names.
  • 3.2+ supports -FN to set scope prefixes

However most RTL/FCL/LCL units are not renamed to their dotted equivalent.


ccrause

  • Hero Member
  • *****
  • Posts: 843
Re: Struggling with a thing that can't be well summarized on this topic line
« Reply #4 on: September 13, 2021, 03:51:13 pm »
Can having them installed has packages help, instead of just adding the sources to the Project Options?
Don't know about packages and adding name spaces.

Assuming you are using Lazarus to manage the project: Create separate build profiles for the two libraries in your test project, where each library's build mode sets the Other unit files setting to point to that library's source folder, and separate Unit output directories so that the compiled units don't clash.

Gustavo 'Gus' Carreno

  • Hero Member
  • *****
  • Posts: 1090
  • Professional amateur ;-P
Re: Struggling with a thing that can't be well summarized on this topic line
« Reply #5 on: September 15, 2021, 02:17:57 pm »
Hey Y'all,

@Martin_fr:
Thanks for that!!
I'm aware of the use of dotted namespacing ever since it was introduced in 3.0.
I've been using it ever since. I was overjoyed when I saw that this carried over from Delphi.

@marcov:
Is there a a link that gives more info on the -FN to set scope prefixes?
If this is what I think, it would, probably, solve my issue.
Well, it's not an issue, it's more of a curiosity, but hey, that's how we learn right?

@ccrause:
Assuming you are using Lazarus to manage the project: Create separate build profiles for the two libraries in your test project, where each library's build mode sets the Other unit files setting to point to that library's source folder, and separate Unit output directories so that the compiled units don't clash.

This option is what I'm trying to avoid. I'm also trying to avoid having 3 diff projects, one for each lib.

I've been aware of dotted namespacing since FPC 3.0 and I've been using it extensively in my personal projects.
My goal here is to have a comparison of all 3 libraries in one single executable, if at all possible.
I'm not quite sure this goal is attainable, since fpc-mardown is a fork of delphi-markdown and they use the same(non dotted namespaced) unit names.
Hence me asking if having them in different packages would allow me to prefix the unit name with the package name.

I'm lost and in need of the forum's overwhelming knowledge of the more savvy users!!

Cheers,
Gus
Lazarus 3.99(main) FPC 3.3.1(main) Ubuntu 23.10 64b Dark Theme
Lazarus 3.0.0(stable) FPC 3.2.2(stable) Ubuntu 23.10 64b Dark Theme
http://github.com/gcarreno

PascalDragon

  • Hero Member
  • *****
  • Posts: 5444
  • Compiler Developer
Re: Struggling with a thing that can't be well summarized on this topic line
« Reply #6 on: September 16, 2021, 09:11:43 am »
@marcov:
Is there a a link that gives more info on the -FN to set scope prefixes?
If this is what I think, it would, probably, solve my issue.
Well, it's not an issue, it's more of a curiosity, but hey, that's how we learn right?

I don't know if the information found its way into the documentation, but there's always my announcement mail of the feature.

Gustavo 'Gus' Carreno

  • Hero Member
  • *****
  • Posts: 1090
  • Professional amateur ;-P
Re: Struggling with a thing that can't be well summarized on this topic line
« Reply #7 on: September 18, 2021, 12:53:25 am »
Hey PascalDragon,

I don't know if the information found its way into the documentation, but there's always my announcement mail of the feature.

So many thanks for that!!!

I had a quick glance at it and it made a bit more sense, but not totally.

My main question is: Do you use that on the Main program compile directives or in the package compile directives?

Cuz it not that clear...

Cheers,
Gus
Lazarus 3.99(main) FPC 3.3.1(main) Ubuntu 23.10 64b Dark Theme
Lazarus 3.0.0(stable) FPC 3.2.2(stable) Ubuntu 23.10 64b Dark Theme
http://github.com/gcarreno

PascalDragon

  • Hero Member
  • *****
  • Posts: 5444
  • Compiler Developer
Re: Struggling with a thing that can't be well summarized on this topic line
« Reply #8 on: September 20, 2021, 09:22:03 am »
My main question is: Do you use that on the Main program compile directives or in the package compile directives?

You need to use it everywhere the compiler is invoked and default namespaces need to be used. It doesn't matter if you compile a whole program or a single unit (with dependencies) as otherwise the compiler simply won't find the correct units.

Gustavo 'Gus' Carreno

  • Hero Member
  • *****
  • Posts: 1090
  • Professional amateur ;-P
Re: Struggling with a thing that can't be well summarized on this topic line
« Reply #9 on: September 20, 2021, 02:23:50 pm »
Hey PascalDragon,

You need to use it everywhere the compiler is invoked and default namespaces need to be used. It doesn't matter if you compile a whole program or a single unit (with dependencies) as otherwise the compiler simply won't find the correct units.

Yeap, makes sense.

And how would you go about setting that up on Lazarus?

Or does it have to be a thing you can only do in a script, or manually somehow?

Again, I'm so sorry for such newb questions and I cherish the morsels of knowledge that you impair on me!!

Cheers,
Gus
Lazarus 3.99(main) FPC 3.3.1(main) Ubuntu 23.10 64b Dark Theme
Lazarus 3.0.0(stable) FPC 3.2.2(stable) Ubuntu 23.10 64b Dark Theme
http://github.com/gcarreno

PascalDragon

  • Hero Member
  • *****
  • Posts: 5444
  • Compiler Developer
Re: Struggling with a thing that can't be well summarized on this topic line
« Reply #10 on: September 21, 2021, 09:08:05 am »
And how would you go about setting that up on Lazarus?

Or does it have to be a thing you can only do in a script, or manually somehow?

I don't know if Lazarus 2.2 will provide an explicit setting for them, but in absence of that you add the namespaces to the Custom Settings of the project or package (just as you'd add them on the command line).

Gustavo 'Gus' Carreno

  • Hero Member
  • *****
  • Posts: 1090
  • Professional amateur ;-P
Re: Struggling with a thing that can't be well summarized on this topic line
« Reply #11 on: September 21, 2021, 04:15:51 pm »
Hey Pascal Dragon,

I don't know if Lazarus 2.2 will provide an explicit setting for them, but in absence of that you add the namespaces to the Custom Settings of the project or package (just as you'd add them on the command line).

Yup, makes sense. I always forget the Custom area, sorry!!

Thanks for the tip!!

Cheers,
Gus
Lazarus 3.99(main) FPC 3.3.1(main) Ubuntu 23.10 64b Dark Theme
Lazarus 3.0.0(stable) FPC 3.2.2(stable) Ubuntu 23.10 64b Dark Theme
http://github.com/gcarreno

 

TinyPortal © 2005-2018