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



On Thu, 2004-07-01 at 16:01, Joe Pluta wrote:
> <laughing>  Joel, that was a big faux pas on my part, I apologize.  You
> do indeed have a fine library of procedures, and they demonstrate the
> problem: by not having some sort of namespace, your modules could
> conceivably collide with someone else's.

No worries :-) 

> One way you could have avoided this by putting a prefix on all of your
> methods as I mentioned in my previous post to Aaron.  Now, the big issue
> that comes into play there is when you want to be able to switch between
> multiple versions of the same class name within different packages.
> Luckily that's rarely an issue for me, but it's really not that much
> prettier with Java; it means you either have to qualify the class
> completely or use an import statement.

My upcoming article on "Encapsulating File Access In a Service Program"
at MidrangeServer uses a similar approach, but based on file names. 
This allows me to have a series of standard procedure names like update,
insert, delete, etc. without the need for some cryptic naming system. 
It also helps self-document the code.

> So the BIG rub is not the naming, or the namespace, but the import
> capabilities - the way that you default the namespace.  Basically the
> idea is being able to overload the class name with the import statement.
> Is that a big issue?  I don't know.

I agree the importing is probably the ultimate bug-a-boo here.  Yes, I
could prefix all my procedures with "xRPGcoreLibrary_" or "comrpgnext_",
but who wants to type that in every time (note to self: next time pick a
shorter product name)  

In Java we typically avoid statements like:

javax.swing.colorchooser.AbstractColorChooserPanel panel = 
  new javax.swing.colorchooser.AbstractColorChooserPanel();

Because the import knows where to find AbstractColorChooserPanel, but at
least we have the option (if we need it) to specify the full path. 
That's what we don't have in RPG.  Maybe the ability to cast a qualified
procedure to another name inside a module?  Let's say I have two
procedures both named "charToNum", but I need both the service
programs...

h CASTPROC( 'RPGNEXTLIB/MYSRVPGM.CHARTONUM' as 'xRPG_charToNum' )
h CASTPROC( 'ANOTHERLIB/OTHSRVPGM.CHARTONUM' as 'other_charToNum' )

This would of course implicitly import those service programs as well. 
Now I've avoided the namespace issue without actual namespace support! 
Of course, this is just an idea, but maybe it has merit?  

We are close to this already with prototyping, but we don't have the
ability to specify a specific procedure in a specific service program. 
Along the same lines, maybe something like this:

d xRPG_charToNum  pr                                              
extproc( 'RPGNEXTLIB/MYSRVPGM.CHARTONUM')

Of course, you'd have to list all the parameters and such... but maybe
some sort of like or copy could be used to alleviate that.

And now I think I've totally digressed from the original topic... what
was it again?

Joel
http://www.rpgnext.com


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.