Recent

Author Topic: Does FPC Lazarus support namespaces?  (Read 7549 times)

JD

  • Hero Member
  • *****
  • Posts: 1910
Does FPC Lazarus support namespaces?
« on: June 28, 2011, 07:01:09 pm »
Hi everybody,

I want to know if FPC/Lazarus supports namespaces like in C++, Java. Some say using namespaces leads to sloppy "sandbox" like programming & irresponsible creation of names & functions. Some say it is inevitable for large projects.

What do you think?

JD
Linux Mint - Lazarus 4.0/FPC 3.2.2,
Windows - Lazarus 4.0/FPC 3.2.2

mORMot 2, PostgreSQL & MariaDB.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12645
  • FPC developer.
Re: Does FPC Lazarus support namespaces?
« Reply #1 on: June 28, 2011, 10:23:54 pm »

I want to know if FPC/Lazarus supports namespaces like in C++, Java. Some say using namespaces leads to sloppy "sandbox" like programming & irresponsible creation of names & functions. Some say it is inevitable for large projects.

Pascal units are also a namespace.

Quote
What do you think?

"Namespaces like .." are a really hard definition  to work with. Can you maybe better explain what you want, rather than pointing at other languages?
 
 
« Last Edit: June 29, 2011, 09:49:22 am by marcov »

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: Does FPC Lazarus support namespaces?
« Reply #2 on: June 28, 2011, 10:54:37 pm »
As Marco mentioned Pascal already has namespace support since ages ... each unit has it's own namespace.

JD

  • Hero Member
  • *****
  • Posts: 1910
Re: Does FPC Lazarus support namespaces?
« Reply #3 on: June 29, 2011, 06:07:33 pm »
As Marco mentioned Pascal already has namespace support since ages ... each unit has it's own namespace.

I actually thought namespaces had to be declared explicitly. If Pascal units are implicitly namespaces then I guess that answers my question. I'm used to making comparisons between languages.
Linux Mint - Lazarus 4.0/FPC 3.2.2,
Windows - Lazarus 4.0/FPC 3.2.2

mORMot 2, PostgreSQL & MariaDB.

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2673
Re: Does FPC Lazarus support namespaces?
« Reply #4 on: July 01, 2011, 01:36:37 am »
THe question is not how to define it, but what you want to solve with it.
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

Leledumbo

  • Hero Member
  • *****
  • Posts: 8835
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Does FPC Lazarus support namespaces?
« Reply #5 on: July 01, 2011, 11:27:39 am »
Actually, that's very easy to test. Try creating two same symbols (function, variable, constant, whatever) in two different units, then use both units (and the symbol) in a program. You'll notice that there's no linker errors.

 

TinyPortal © 2005-2018