Date() question

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Date() question

Robert L Hamilton
say version; say date();

gives the following response.  Where is date() coming from?

NetRexx 2.05 14 Jan 2005
Tue Jan 24 12:05:09 CST 2012

Thanks for your time and Enjoy the Day.

Bob Hamilton
Richardson Texas USA

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Date() question

Marc Simpson
On Tue, Jan 24, 2012 at 6:23 PM, Robert Hamilton <[hidden email]> wrote:
> say version; say date();
>
> gives the following response.  Where is date() coming from?

It's equivalent to: new java.util.Date(); the import is implicit. From
the (latest version of the) manual,

--8<------------------------------------
In the reference implementation, the fundamental NetRexx and Java
package hierarchies are automatically imported by default, as though
the instructions:

  import netrexx.lang.
  import java.lang.
  import java.io.
  import java.util.
  import java.net.
  import java.awt.
  import java.applet.

had been executed before the program begins. In addition, classes in
the current (working) directory are imported if no package instruction
is specified. If a package instruction is specified then all classes
in that package are imported.
--8<------------------------------------

Hope that helps;
Best,
M


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Date() question

ThSITC
In reply to this post by Robert L Hamilton
Hi Robert,

   in NetRexx,

*when* you are **NOT** using my (a bit ancient) Rexx2Nrx RunTime Routines, which do implement
date() an time() in the 'classic Rexx' syntax (see: www.Rexx2Nrx.com, RUN-Time Routines),

*then* you are using (referencing) the JAVA Routines with the same name ;-)

Easiest way is to GOOGLE: Java date   (I think, but never did trie it) ;-)

I did get so many advises the past months to:

 a) first GOOGLE
 b) then ASK a question

I'm trying to follow this rule, now ;-)#Massa Thomas.
========================================================
Am 24.01.2012 19:23, schrieb Robert Hamilton:
say version; say date();

gives the following response.  Where is date() coming from?

NetRexx 2.05 14 Jan 2005
Tue Jan 24 12:05:09 CST 2012

Thanks for your time and Enjoy the Day.

Bob Hamilton
Richardson Texas USA


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/



--
Thomas Schneider (Founder of www.thsitc.com) Member of the Rexx Languge Asscociation (www.rexxla.org) Member of the NetRexx Developer's Team (www.netrexx.org)

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Thomas Schneider, Vienna, Austria (Europe) :-)

www.thsitc.com
www.db-123.com
Reply | Threaded
Open this post in threaded view
|

Re: Date() question

ThSITC
In reply to this post by Marc Simpson
Hello Marc Simpson,

    1.) thanks for this insight (already forgot it, due to working at
*and* in too many languages)
    2.)  ** whole GROUP**, please see below:

Questions (as always), when you DO know me ;-)

*Is it still a WISE decision to implicitely import java.awt* ???

Shouldn't we:

    a) Change the still existing NetRexx IBM RED Book to use the more
modern.
(NOT obsolete) classes & methods for SCRREN I/O (as I call it)
    b) ABANDON *AWT suppoirt*, after replacing all of this stuff by the
current Java Techology
    c) Change the *Reference Compiler* to implicitely import the current
state of the art?


What do you say, friends?

Massa Thomas.
===================================================================================
Am 24.01.2012 19:38, schrieb Marc Simpson:

> On Tue, Jan 24, 2012 at 6:23 PM, Robert Hamilton<[hidden email]>  wrote:
>> say version; say date();
>>
>> gives the following response.  Where is date() coming from?
> It's equivalent to: new java.util.Date(); the import is implicit. From
> the (latest version of the) manual,
>
> --8<------------------------------------
> In the reference implementation, the fundamental NetRexx and Java
> package hierarchies are automatically imported by default, as though
> the instructions:
>
>    import netrexx.lang.
>    import java.lang.
>    import java.io.
>    import java.util.
>    import java.net.
>    import java.awt.
>    import java.applet.
>
> had been executed before the program begins. In addition, classes in
> the current (working) directory are imported if no package instruction
> is specified. If a package instruction is specified then all classes
> in that package are imported.
> --8<------------------------------------
>
> Hope that helps;
> Best,
> M
>
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
> Online Archive : http://ibm-netrexx.215625.n3.nabble.com/
>
>


--
Thomas Schneider (Founder of www.thsitc.com) Member of the Rexx Languge
Asscociation (www.rexxla.org) Member of the NetRexx Developer's Team
(www.netrexx.org)

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Thomas Schneider, Vienna, Austria (Europe) :-)

www.thsitc.com
www.db-123.com
Reply | Threaded
Open this post in threaded view
|

Re: Date() question

billfen
In reply to this post by Robert L Hamilton
I think there should be a translator option to control the default java
imports, perhaps "defaultimports" and "nodefaultimports".  The default for
the option would be "defaultimports" to avoid breakage.  

I think this can be justified for both performance and conflict prevention
reasons.  If libraries such as .net, .awt or .applet are not necessary, why
should they be imported?  

Original Message:
-----------------
From: Marc Simpson [hidden email]
Date: Tue, 24 Jan 2012 18:38:18 +0000
To: [hidden email]
Subject: Re: [Ibm-netrexx] Date() question


On Tue, Jan 24, 2012 at 6:23 PM, Robert Hamilton <[hidden email]>
wrote:
> say version; say date();
>
> gives the following response.  Where is date() coming from?

It's equivalent to: new java.util.Date(); the import is implicit. From
the (latest version of the) manual,

--8<------------------------------------
In the reference implementation, the fundamental NetRexx and Java
package hierarchies are automatically imported by default, as though
the instructions:

  import netrexx.lang.
  import java.lang.
  import java.io.
  import java.util.
  import java.net.
  import java.awt.
  import java.applet.

had been executed before the program begins. In addition, classes in
the current (working) directory are imported if no package instruction
is specified. If a package instruction is specified then all classes
in that package are imported.
--8<------------------------------------

Hope that helps;
Best,
M


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/


--------------------------------------------------------------------
mail2web.com – Enhanced email for the mobile individual based on Microsoft®
Exchange - http://link.mail2web.com/Personal/EnhancedEmail



_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Date() question

alansam
In reply to this post by Marc Simpson


On 24 January 2012 10:38, Marc Simpson <[hidden email]> wrote:
On Tue, Jan 24, 2012 at 6:23 PM, Robert Hamilton <[hidden email]> wrote:
> say version; say date();
>
> gives the following response.  Where is date() coming from?

It's equivalent to: new java.util.Date(); the import is implicit. From
the (latest version of the) manual,

--8<------------------------------------
In the reference implementation, the fundamental NetRexx and Java
package hierarchies are automatically imported by default, as though
the instructions:

 import netrexx.lang.
 import java.lang.
 import java.io.
 import java.util.
 import java.net.
 import java.awt.
 import java.applet.

had been executed before the program begins. In addition, classes in
the current (working) directory are imported if no package instruction
is specified. If a package instruction is specified then all classes
in that package are imported.
--8<------------------------------------

Hope that helps;
Best,
M


And if you add 

options format

then compile with the -keep (or -keepasjava if you have the latest & greatest compiler) and look at the resulting Java output file you'll see something like this:

public static void main(java.lang.String $0s[]){
  netrexx.lang.RexxIO.Say($01);
  netrexx.lang.RexxIO.Say(new java.util.Date());
  return;}
 
which is exactly as Marc indicated.

I recommend you look at the documentation for java.util.Date and in particular the toString() method.  That's the method that Java will invoke under the covers when it determines you wish to convert an Object into a String.  The netrexx.lang.RexxIO.Say object is unlikely to have a constructor for java.util.Date but will happily take a String object, so Java obliges by calling an object's toString() method in an attempt to be helpful.

Alan.

--
Can't tweet, won't tweet!

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Alan

--
Needs more cowbell.
Reply | Threaded
Open this post in threaded view
|

Re: Date() question

alansam
In reply to this post by billfen


On 24 January 2012 11:59, [hidden email] <[hidden email]> wrote:
I think there should be a translator option to control the default java
imports, perhaps "defaultimports" and "nodefaultimports".  The default for
the option would be "defaultimports" to avoid breakage.

I think this can be justified for both performance and conflict prevention
reasons.  If libraries such as .net, .awt or .applet are not necessary, why
should they be imported?


I think it depends on path length.  If it takes longer for the compiler to assemble the list of classes to import before it gets going than it does to import a bunch of references that you're not going to use it would be counterproductive.  A compiler needs to be as fast as possible for efficient bulk builds, putting an "expensive" test in front may impact build times.

Alan.

--
Can't tweet, won't tweet!

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Alan

--
Needs more cowbell.
Reply | Threaded
Open this post in threaded view
|

RE: Date() question

Mike Cowlishaw

 

I think it depends on path length.  If it takes longer for the compiler to assemble the list of classes to import before it gets going than it does to import a bunch of references that you're not going to use it would be counterproductive.  A compiler needs to be as fast as possible for efficient bulk builds, putting an "expensive" test in front may impact build times.

Importing costs nothing until something is being looked for and cannot be found in what is already known.  It wasn't a performance issue in 1996; hard to make the case that it is now....
 
The more complicated issue is 'programmer time'.  The basics:
 
import netrexx.lang.
import java.lang.
import java.io.
import java.util.
import java.net.
look like 'no-brainers'.  awt and applet seemed that way back then .. but maybe were a bad choice.  But little harm done, methinks?
 
Mike

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/