On page 172 there's a netrexx example; it has the statement:
parse Date() . . . Now . Net Rexx evidently does not have a Date() function so this must be JAVA, no? My question is: how can I know which functions can deal with JAVA and which cannot. The program runs but does not require an Import . . . thanks for the Time; Enjoy the Day Bob Hamilton _______________________________________________ Ibm-netrexx mailing list [hidden email] |
On 10/27/2010 11:39 AM, Robert Hamilton wrote:
> My question is: how can I know which functions can deal with JAVA and > which cannot. > NetRexx becomes Java as soon as you run it through the compiler. If a function is not mentioned in the index of the PDF, then it's not NetRexx and (thus) is Java. The power of NetRexx is that it delivers the universe of the Java libraries without burdening you with the corresponding syntax. And, NetRexx imports a bunch of stuff on its own to simplify your life even more. Tom. _______________________________________________ Ibm-netrexx mailing list [hidden email] |
> And, NetRexx imports a bunch of stuff on its own to simplify > your life even more. Yep -- see page 88 of the NetRexx 2 document. I forget which provides that Date() constructor, but I'd guess java.util. Mike _______________________________________________ Ibm-netrexx mailing list [hidden email] |
In reply to this post by Robert L Hamilton
On page 88 the default Java packages imported by NetRexx are listed:
import netrexx.lang. import java.lang. import java.io. import java.util. import java.net. import java.awt. import java.applet. The only ones I normally have to add are these: import java.text. import javax.swing. The complete list is found at Oracle: http://download.oracle.com/javase/6/docs/api/ -- Kermit On 10/27/2010 9:39 AM, Robert Hamilton wrote: On page 172 there's a netrexx example; it has the statement: _______________________________________________ Ibm-netrexx mailing list [hidden email] |
In reply to this post by Tom Maynard
Tom; Thanks for your time. If I put the statement in curly brackets it chokes; I guess your statement if it ain't in netrexx it will deal with java some of the time.
BobH On Wed, Oct 27, 2010 at 12:30 PM, Tom Maynard <[hidden email]> wrote:
_______________________________________________ Ibm-netrexx mailing list [hidden email] |
On 10/27/2010 2:35 PM, Robert Hamilton wrote:
> If I put the statement in curly brackets it chokes; Curly brackets are not part of the NetRexx language. You won't find them in the manual. What you need to understand is that NetRexx is a language that interoperates with Java ("rides on top" if you will). Because of this you can invoke Java library functions directly, and process the results, without all the silly brackets. > if it ain't in netrexx it will deal with java some of the time. > Oh, no. ALL of the time. But NetRexx is not blended with Java, it's a completely separate thing -- they just happen to share a common library, and they can communicate with each other seamlessly. Remember: NetRexx turns into Java as soon as you run it through the compiler. Save the Java output file sometime and see for yourself -- use the "-keep" option and then edit the resulting file. Tom (in VERY windy Chicago). _______________________________________________ Ibm-netrexx mailing list [hidden email] |
And I would never have thought to use Date(). That's my point. Is there some list of Java things that NetRexx can deal with.
bobh _______________________________________________ Ibm-netrexx mailing list [hidden email] |
In reply to this post by Robert L Hamilton
Bob, My answer would be that NetRexx does not deal with java (the language) at all but in general always deal with java *objects* (not functions!) There is no such thing as a java function. They are methods either of an object or of a class. The distinction is important as we'll see below. For the time being, every time you see something resembling a function call (without a class or object prepended) you should suspect and object is being created. Your example is a little obscure as there are quite a few things going on automatically under the hood. It could be rewritten like this: dateObj = java.util.Date() dateString = java.lang.String.valueOf(dateObj) dateRexx = netrexx.lang.Rexx(dateString) parse dateRexx . . . Now . What is happening is: - NetRexx automatically imports a number of packages so classes can be referred by their short names without previous import instructions - "Date()" is actually creating a Date object initialized to "now" - NetRexx automatically converts this object to a Rexx string apt for parse in two steps. - First converts to a java String object via a String class method (could also have been dateObj.toString()) - Then creates a new Rexx string by using one of its many constructors. The one taking a java String. - this last object is given to "parse" to do its thing. In most instances you don't need to worry about converting from Rexx to java String or vice versa as NetRexx does this for you. With other java classes you'll get mixed results. NetRexx will always print something when you throw an object to a "say" instruction. Unfortunately not all java classes have toString() methods as useful as java.util.Date does. If I had written that snippet I would have probably done like this: today = Date().toString() parse today . . . Now . --- Saludos / Kind regards. David Requena El 27/10/2010 18:39, Robert Hamilton escribió: On page 172 there's a netrexx example; it has the statement: _______________________________________________ Ibm-netrexx mailing list [hidden email] |
In reply to this post by Robert L Hamilton
Oh, that one is easy: NetRexx can deal with all of them!! See http://download.oracle.com/javase/6/docs/api/index.html for the whole java library documentation. --- Saludos / Kind regards. David Requena El 27/10/2010 23:44, Robert Hamilton escribió: And I would never have thought to use Date(). That's my point. Is there some list of Java things that NetRexx can deal with. _______________________________________________ Ibm-netrexx mailing list [hidden email] |
And of course, that's only the tip of the iceberg. The world of java
classes is much larger than just those that make up the runtime library of the JVM. Rick On Wed, Oct 27, 2010 at 6:01 PM, David Requena <[hidden email]> wrote: > > Oh, that one is easy: NetRexx can deal with all of them!! > > See http://download.oracle.com/javase/6/docs/api/index.html for the whole > java library documentation. > > --- > Saludos / Kind regards. > David Requena > > El 27/10/2010 23:44, Robert Hamilton escribió: > > And I would never have thought to use Date(). That's my point. Is there > some list of Java things that NetRexx can deal with. > > bobh > > > > _______________________________________________ > Ibm-netrexx mailing list > [hidden email] > > > _______________________________________________ > Ibm-netrexx mailing list > [hidden email] > > > _______________________________________________ Ibm-netrexx mailing list [hidden email] |
Violently agreed :-)
- Saludos / Kind regards, David Requena -----Original Message----- From: Rick McGuire <[hidden email]> Sender: [hidden email] Date: Wed, 27 Oct 2010 18:10:32 To: IBM Netrexx<[hidden email]> Reply-To: IBM Netrexx <[hidden email]> Subject: Re: [Ibm-netrexx] NetRexx 2 -- 22 May 2009; jEdit w/ netrexx script plugin And of course, that's only the tip of the iceberg. The world of java classes is much larger than just those that make up the runtime library of the JVM. Rick On Wed, Oct 27, 2010 at 6:01 PM, David Requena <[hidden email]> wrote: > > Oh, that one is easy: NetRexx can deal with all of them!! > > See http://download.oracle.com/javase/6/docs/api/index.html for the whole > java library documentation. > > --- > Saludos / Kind regards. > David Requena > > El 27/10/2010 23:44, Robert Hamilton escribió: > > And I would never have thought to use Date(). That's my point. Is there > some list of Java things that NetRexx can deal with. > > bobh > > > > _______________________________________________ > Ibm-netrexx mailing list > [hidden email] > > > _______________________________________________ > Ibm-netrexx mailing list > [hidden email] > > > _______________________________________________ Ibm-netrexx mailing list [hidden email] _______________________________________________ Ibm-netrexx mailing list [hidden email] |
In reply to this post by Robert L Hamilton
Bob,
You're right, but the list of identical things is small. I hope I'm not doing too much damage to the truth with the following. The identical things are pretty much confined to those necessary to invoke Java classes and methods. The syntax for invoking class methods is identical, ie class.method(arguments). If you mention a class that is not already known to NetRexx, NetRexx will silently search through the most popular Java packages for such a class and use it if found; hence Java's Date() is found automatically. This can work because NetRexx classes are indistinguishable from Java classes by design. The other necessary element to call Java classes is be able to pass method arguments. In Java these can be either classes (again, the same in both languages), or 'primitive types', eg int, char etc. This is neatly dealt with by giving these identical definitions in NetRexx. [There is even an ingenious system for recognizing and using argument types that are almost, but not quite, right.] Almost anything else you write using Java syntax will be found wrong or misinterpreted. For example, if you try to write a loop, 'for ...' in Java syntax, NetRexx won't know what you are talking about: it expects 'loop...'. We True Believers feel that, except to understand Java class documentation, it is almost counterproductive (I exaggerate) to know Java syntax -- NetRexx's equivalent is in almost all respects superior. The purpose of all this is to commandeer the Java Class Library -- the product of years of work by an army of programmers -- without having to use the dreaded Java syntax. On Wed, Oct 27, 2010 at 5:44 PM, Robert Hamilton <[hidden email]> wrote: And I would never have thought to use Date(). That's my point. Is there some list of Java things that NetRexx can deal with. _______________________________________________ Ibm-netrexx mailing list [hidden email] |
Hear, hear, George!
I don't know what, if any, damage you did to The Truth, but you spoke the truth as I see it. One of the hardest concepts to get across to folks seems to be the distinction between Java-the-language and Java-the-class-libraries, Java-the-platform, Java-the-environment, Java-the-everything-else. (With your permission, I intend to start using the acronym DJS. ;-) And Bob, may I suggest that if you are trying to do something in NetRexx with say, dates, you might consider firing up Google and entering "java date". You'll get a pageful of links to the Java documentation on how to use it. -Chip- On 10/27/10 23:38 George Hovey said: > Bob, > You're right, but the list of identical things is small. I hope I'm not > doing too much damage to the truth with the following. > > The identical things are pretty much confined to those necessary to > invoke Java classes and methods. The syntax for invoking class methods > is identical, ie class.method(arguments). If you mention a class that > is not already known to NetRexx, NetRexx will silently search through > the most popular Java packages for such a class and use it if found; > hence Java's Date() is found automatically. This can work because > NetRexx classes are indistinguishable from Java classes by design. > > The other necessary element to call Java classes is be able to pass > method arguments. In Java these can be either classes (again, the same > in both languages), or 'primitive types', eg int, char etc. This is > neatly dealt with by giving these identical definitions in NetRexx. > [There is even an ingenious system for recognizing and using argument > types that are almost, but not quite, right.] > > Almost anything else you write using Java syntax will be found wrong or > misinterpreted. For example, if you try to write a loop, 'for ...' in > Java syntax, NetRexx won't know what you are talking about: it expects > 'loop...'. We True Believers feel that, except to understand Java class > documentation, it is almost counterproductive (I exaggerate) to know > Java syntax -- NetRexx's equivalent is in almost all respects superior. > > The purpose of all this is to commandeer the Java Class Library -- the > product of years of work by an army of programmers -- without having to > use the dreaded Java syntax. > > > On Wed, Oct 27, 2010 at 5:44 PM, Robert Hamilton <[hidden email] > <mailto:[hidden email]>> wrote: > > And I would never have thought to use Date(). That's my point. Is > there some list of Java things that NetRexx _can _deal with. > > bobh > > > > _______________________________________________ > Ibm-netrexx mailing list > [hidden email] <mailto:[hidden email]> > > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Ibm-netrexx mailing list > [hidden email] > Ibm-netrexx mailing list [hidden email] |
I must confess that Bob's questions generally puzzle me - I have no idea
why anyone would want to mix wonderful clean NetRexx with that horrible Java syntax of braces and superfluous semicolons everywhere. (DJS) But on second thought, I wonder if perhaps Bob does not know that, practically speaking, NetRexx is a completely different language from Java that just happens to be able to access all Java objects (with a few exceptions that have already been reported as bugs here). And I wonder if there are more people like Bob who are beginners with NetRexx and even Java and do not know the relationship of the two languages and how they interact. That learning curve would include the various aspects of Java that Chip just mentioned. We have discussed the need for additional technical documentation for NetRexx, especially in the area of installation. But here is a new question - Do we as a community need to provide a "Beginner's Guide to NetRexx" type of document that addresses things like what you can do with NetRexx and how it is related to Java and especially how it interacts with Java objects and how to make use of them? -- Kermit On 10/28/2010 6:34 AM, Chip Davis wrote: > Hear, hear, George! > > I don't know what, if any, damage you did to The Truth, but you spoke > the truth as I see it. > > One of the hardest concepts to get across to folks seems to be the > distinction between Java-the-language and Java-the-class-libraries, > Java-the-platform, Java-the-environment, Java-the-everything-else. > (With your permission, I intend to start using the acronym DJS. ;-) > > And Bob, may I suggest that if you are trying to do something in > NetRexx with say, dates, you might consider firing up Google and > entering "java date". You'll get a pageful of links to the Java > documentation on how to use it. > > -Chip- > > On 10/27/10 23:38 George Hovey said: >> Bob, >> You're right, but the list of identical things is small. I hope I'm >> not doing too much damage to the truth with the following. >> >> The identical things are pretty much confined to those necessary to >> invoke Java classes and methods. The syntax for invoking class >> methods is identical, ie class.method(arguments). If you mention a >> class that is not already known to NetRexx, NetRexx will silently >> search through the most popular Java packages for such a class and >> use it if found; hence Java's Date() is found automatically. This >> can work because NetRexx classes are indistinguishable from Java >> classes by design. >> >> The other necessary element to call Java classes is be able to pass >> method arguments. In Java these can be either classes (again, the >> same in both languages), or 'primitive types', eg int, char etc. >> This is neatly dealt with by giving these identical definitions in >> NetRexx. [There is even an ingenious system for recognizing and >> using argument types that are almost, but not quite, right.] >> >> Almost anything else you write using Java syntax will be found wrong >> or misinterpreted. For example, if you try to write a loop, 'for >> ...' in Java syntax, NetRexx won't know what you are talking about: >> it expects 'loop...'. We True Believers feel that, except to >> understand Java class documentation, it is almost counterproductive >> (I exaggerate) to know Java syntax -- NetRexx's equivalent is in >> almost all respects superior. >> >> The purpose of all this is to commandeer the Java Class Library -- >> the product of years of work by an army of programmers -- without >> having to use the dreaded Java syntax. >> >> >> On Wed, Oct 27, 2010 at 5:44 PM, Robert Hamilton <[hidden email] >> <mailto:[hidden email]>> wrote: >> >> And I would never have thought to use Date(). That's my point. Is >> there some list of Java things that NetRexx _can _deal with. >> >> bobh >> >> >> _______________________________________________ >> Ibm-netrexx mailing list >> [hidden email] <mailto:[hidden email]> >> >> >> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Ibm-netrexx mailing list >> [hidden email] >> > _______________________________________________ > Ibm-netrexx mailing list > [hidden email] > > > Ibm-netrexx mailing list [hidden email] |
On 10/28/2010 1:48 PM, Kermit Kiser wrote:
> > We have discussed the need for additional technical documentation for > NetRexx, especially in the area of installation. But here is a new > question - Do we as a community need to provide a "Beginner's Guide to > NetRexx" type of document that addresses things like what you can do > with NetRexx and how it is related to Java and especially how it > interacts with Java objects and how to make use of them? > Here http://java.sys-con.com/node/36620 is a reasonably objective view of NetRexx, and it calls out installation issues among other bumps in the NetRexx road. The article also specifically mentions a "Beginner's Guide" ... and mistakenly assumes that there is one. It would be nice to have an installer (EXE or self-extracting ZIP). I recently installed NetRexx under Cygwin (under Windows) and had a devil of a time getting it going ... and I already have a working copy on another machine. I spent about 80% of my professional career as a programmer of one kind or another, and a beginner's guide holds no value for me -- but that's me. How about a poll of the list? I'll cast my vote now: No, thanks. That said, I certainly see the value of a brief tutorial on invoking Java objects from NetRexx ... the Date() example is good, what other objects are commonly used? A list of those, with concise examples, would get most folks off to a good start. Tom. _______________________________________________ Ibm-netrexx mailing list [hidden email] |
Tom,
I'm curious about your "under cygwin" installation. Why would you want such a thing? Are you using GNU's gjc instead of Sun's javac? - Saludos / Kind regards, David Requena -----Original Message----- From: Tom Maynard <[hidden email]> Sender: [hidden email] Date: Thu, 28 Oct 2010 14:33:58 To: IBM Netrexx<[hidden email]> Reply-To: IBM Netrexx <[hidden email]> Subject: Re: [Ibm-netrexx] NetRexx 2 -- 22 May 2009; jEdit w/ netrexx script plugin On 10/28/2010 1:48 PM, Kermit Kiser wrote: > > We have discussed the need for additional technical documentation for > NetRexx, especially in the area of installation. But here is a new > question - Do we as a community need to provide a "Beginner's Guide to > NetRexx" type of document that addresses things like what you can do > with NetRexx and how it is related to Java and especially how it > interacts with Java objects and how to make use of them? > Here http://java.sys-con.com/node/36620 is a reasonably objective view of NetRexx, and it calls out installation issues among other bumps in the NetRexx road. The article also specifically mentions a "Beginner's Guide" ... and mistakenly assumes that there is one. It would be nice to have an installer (EXE or self-extracting ZIP). I recently installed NetRexx under Cygwin (under Windows) and had a devil of a time getting it going ... and I already have a working copy on another machine. I spent about 80% of my professional career as a programmer of one kind or another, and a beginner's guide holds no value for me -- but that's me. How about a poll of the list? I'll cast my vote now: No, thanks. That said, I certainly see the value of a brief tutorial on invoking Java objects from NetRexx ... the Date() example is good, what other objects are commonly used? A list of those, with concise examples, would get most folks off to a good start. Tom. _______________________________________________ Ibm-netrexx mailing list [hidden email] _______________________________________________ Ibm-netrexx mailing list [hidden email] |
On 10/28/2010 3:08 PM, David Requena wrote:
There are several reasons: I spend a lot of time at the command prompt, and Cygwin is friendlier than DOS, I do a number of other tasks ... ConTeXt, (La)TeX, Literate Programming, etc. ... and it's convenient to have it all "under one roof" instead of switching back and forth. I also spent a number of years as a Unix SysAdmin and am quite comfortable with Cygwin, the bash shell, and (g)Vim.I'm curious about your "under cygwin" installation. Why would you want such a thing? Are you using GNU's gjc instead of Sun's javac? I use All this raises the question: "Why not just use Linux?" The answer: all my other applications! I have several IDEs that are Windows-only (not to mention my solitaire game). Cygwin gives me the best of both worlds. Tom. _______________________________________________ Ibm-netrexx mailing list [hidden email] |
In reply to this post by David Requena
On 10/28/2010 3:08 PM, David Requena wrote:
Here's an example of calling Java objects from NetRexx. One of the things I commonly do is write a program that issues an operating system command, and then deal with the results in some fashion. This one just echos the output onto the screen, but it demonstrates the concept:I'm curious about your "under cygwin" installation. Why would you want such a thing? Are you using GNU's gjc instead of Sun's javac? /* * OSCall - issue an Operating System command */ r = Runtime.getRuntime() do line = Rexx p = r.exec("ls -l") in = p.getInputStream() buf = BufferedInputStream(in) inread = InputStreamReader(buf) mybufferedreader = BufferedReader(inread) line = mybufferedreader.readline() loop while line \= null Say line line = mybufferedreader.readline() end catch RuntimeException Say "Oops ... something went wrong" finally mybufferedreader.close() inread.close() buf.close() in.close() end This is obviously a Cygwin version. It's a bit more complicated with Windows commands, but the principle remains the same. This was obviously not written for public consumption, but I post it anyway in the hope it will be instructive. It might be beneficial if everyone put up a small example like this, opening and reading a file, getting/setting environment variables, printing something, etc. They could then be collected together to form the basis of a Beginner's Guide. (Or, in this case, a Cookbook) Tom. _______________________________________________ Ibm-netrexx mailing list [hidden email] |
In reply to this post by Tom Maynard
Tom,
It seems to me the issue is not whether you need a beginner's guide (you obviously don't) but whether it's needed to promote the expansion of NetRexx use. If we are serious about attracting programmers from non-Java (even non-OO) backgrounds, then I think the answer is a resounding yes. Bob Hamilton's idea of seeing what NetRexx would do with java code strikes me as perfectly reasonable. After all, in this forum one hears constantly about Java interoperability; it's not surprising that he was misled into believing that NetRexx is a superset of Java. Nobody explicitly said otherwise. The true relationship is clear to everyone from a Java background, but this should set off alarm bells: it totally went over our heads that Bob does not share our experiences and assumptions, and we couldn't put ourselves in his shoes. This bodes ill for our ability to connect with newcomers. I think some concentrated thought is in order on why NetRexx isn't already a smashing success. On Thu, Oct 28, 2010 at 3:33 PM, Tom Maynard <[hidden email]> wrote:
_______________________________________________ Ibm-netrexx mailing list [hidden email] |
That said, I certainly see the value of a brief tutorial
on invoking Java objects from NetRexx ... the Date() example is good, what other
objects are commonly used? A list of those, with concise examples, would
get most folks off to a good start.
There is this: http://kermitkiser.com/NetRexx/atOnce/netrexxAtOnce.html
Mike
_______________________________________________ Ibm-netrexx mailing list [hidden email] |
Free forum by Nabble | Edit this page |