Recent

Author Topic: Namespace (doted) support for unit names  (Read 7394 times)

runner

  • New Member
  • *
  • Posts: 12
Namespace (doted) support for unit names
« on: December 17, 2012, 10:52:15 am »
I already searched the net and forums, but have not found a true definitive answer. Is namespace in unit names supported in FPC and IDE?

For instance a name like; MyCompany.MyUnit.pas

I am interested if:

1. FPC compiler supports this
2. Lazarus IDE supports this.

This is important if I port my Delphi library to FPC. I am not going to drop namespaces as they are a very clean way to organize the units. I want to know exact version of FPC and Lazarus IDE that support this (if they do).

Thanks for the help.

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1946
Re: Namespace (doted) support for unit names
« Reply #1 on: December 17, 2012, 11:36:19 am »
« Last Edit: December 17, 2012, 11:38:58 am by theo »

runner

  • New Member
  • *
  • Posts: 12
Re: Namespace (doted) support for unit names
« Reply #2 on: December 17, 2012, 01:32:50 pm »
Thanks for the info. If I understand correctly the last Lazarus build does not yes use this version of FPC?

And how about Lazarus. Is IDE already compatible with namespaces in unit names?

Leledumbo

  • Hero Member
  • *****
  • Posts: 8836
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Namespace (doted) support for unit names
« Reply #3 on: December 17, 2012, 01:36:26 pm »
Quote
Thanks for the info. If I understand correctly the last Lazarus build does not yes use this version of FPC?
No, and will never. Release version of Lazarus will use release version of FPC as well.
Quote
And how about Lazarus. Is IDE already compatible with namespaces in unit names?
AFAIK not yet, and I haven't seen anything related to it in mantis.

User137

  • Hero Member
  • *****
  • Posts: 1791
    • Nxpascal home
Re: Namespace (doted) support for unit names
« Reply #4 on: December 17, 2012, 01:36:53 pm »
Thanks for the info. If I understand correctly the last Lazarus build does not yes use this version of FPC?
SVN version of Lazarus is well compatible with latest SVN of fpc (it is 2.7.1 but it gets new subversions all the time).

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1946
Re: Namespace (doted) support for unit names
« Reply #5 on: December 17, 2012, 01:53:49 pm »
Quote
And how about Lazarus. Is IDE already compatible with namespaces in unit names?
AFAIK not yet, and I haven't seen anything related to it in mantis.

Quote from: Mattias
It is supported by FPC and I implemented a few things in the IDE. "Find
declaration" does not yet support it.
 

http://lists.lazarus.freepascal.org/pipermail/lazarus/2011-November/068430.html

runner

  • New Member
  • *
  • Posts: 12
Re: Namespace (doted) support for unit names
« Reply #6 on: December 17, 2012, 01:54:05 pm »
Ok, thanks all for the replies. Now I know where I stand. Namespace support is very important to me. I find it strange to read that a lot of Lazarus and FPC users think that is is not important at all. It is a great way to organize the units very well. So I think then when it is fully supported it will be a great addition to already great tools.

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1946
Re: Namespace (doted) support for unit names
« Reply #7 on: December 17, 2012, 02:02:59 pm »
You can install FPC and Lazarus SVN Version and try it.

http://wiki.freepascal.org/Installing_Lazarus


Leledumbo

  • Hero Member
  • *****
  • Posts: 8836
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Namespace (doted) support for unit names
« Reply #8 on: December 17, 2012, 02:57:54 pm »
Quote
I find it strange to read that a lot of Lazarus and FPC users think that is is not important at all. It is a great way to organize the units very well.
Both approaches (namespace and flat unit) has their own advantages and disadvantages. You'll find yourself in trouble when you want to refactor you namespaces.

runner

  • New Member
  • *
  • Posts: 12
Re: Namespace (doted) support for unit names
« Reply #9 on: December 17, 2012, 03:51:10 pm »
I am using namespaces for a long time. All my units in projects and libraries have namespaces. I have not found a single bad thing about them. Sure if you want to change a namespace you will have to work a lot to achieve that but it goes the same for regular flat names if you have to change them.

I find two aspects of namespaces very important.

1. They automatically organize and categorize your units of the filename level. like a library. I find that very important. But I am sort of a code tyrant :) I like things very organized.
2. They prevent unit names collision. I have seen more then one such collision from different libraries. And it brings a lot of pain. I know you can just camel case the units with some prefix, but for me its just not the same. Even _ is not the same. I guess comming from windows enviroment that dot has a special meaning and is in a way mentally suiting :)

 

TinyPortal © 2005-2018