× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Think about them from a function level. I have a service program that
does customer related functions. I also have a function that does vendor
related functions. Both have a getAddress function. With namespaces you
can do this with having a naming collision. Without namespaces if I want
to include both service programs in the same program, I need separate
names for getAddress - CustGetAddress and VendGetAddress for example.

Here is the description from the PHP manual which describes it pretty
well:

Namespaces overview

What are namespaces? In the broadest definition namespaces are a way of
encapsulating items. This can be seen as an abstract concept in many
places. For example, in any operating system directories serve to group
related files, and act as a namespace for the files within them. As a
concrete example, the file foo.txt can exist in both directory
/home/greg and in /home/other, but two copies of foo.txt cannot co-exist
in the same directory. In addition, to access the foo.txt file outside
of the /home/greg directory, we must prepend the directory name to the
file name using the directory separator to get /home/greg/foo.txt. This
same principle extends to namespaces in the programming world.

In the PHP world, namespaces are designed to solve two problems that
authors of libraries and applications encounter when creating re-usable
code elements such as classes or functions:

1. Name collisions between code you create, and internal PHP
classes/functions/constants or third-party classes/functions/constants.
2. Ability to alias (or shorten) Extra_Long_Names designed to
alleviate the first problem, improving readability of source code.

http://php.net/manual/en/language.namespaces.rationale.php

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Jerry Adams
Sent: Wednesday, January 13, 2010 8:52 AM
To: RPG programming on the IBM i / System i
Subject: RE: RPGV?

I admit that I had never heard the term "namespaces" prior to this
thread. So I did a search. Most of the references I found dealt with
XML and a few with Java script neither of which (correct me if I err) is
OO.

But that's not my point. If I interpreted the sources correctly (again,
corrections welcome), qualified data structures are a namespace. Beyond
that what is meant by namespaces in RPG? I.e., are we talking about
qualifying the field names by file/table name, such as FILEA:FIELDA,
FILEB:FIELDA, with a "Qualified" keyword on the F-spec? Or something
else/more? Why is this such a hot button?

Thanks.

Jerry C. Adams
IBM System i Programmer/Analyst
--
B&W Wholesale
office: 615-995-7024
email: jerry@xxxxxxxxxxxxxxx






Kevin Bucknum
Senior Programmer Analyst
MEDDATA/MEDTRON
Tel: 985-893-2550


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.