----- Original Message -----
From: "Stefano Mazzocchi" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, June 28, 2000 03:29
Subject: Re: aspectJ (was Re: [PATCH] build events)


> <rant about="Microsoft C#">
> C# is the most incredibly obvious Java-clone in existance. They claim it
> was invented only with experience from C/C++ but do you believe that?
> They cloned everything and they even got it WRONG!! Look at namespaces,
> look at pointer availability.

It's a bit like the engineers were told to make 'an easier to use version of
C++' without being allowed to read the java manual -just being told of some
of the language features by someone in marketing who could not remember the
syntax. So things in java (instanceof, boolean, synchronized) get
equivalents with the wrong names (is, bool, lock)

Also the bits of VJ++ that nobody used (delegates) are in there, still for
no apparent reason.

> And they add _nothing_ that Java doesn't have today

1. there's goto (!)
2. even the primary types (int &c) derive from object (someone must have
read the smalltalk manual)
3. variable length arguments are permitted
4. properties can have explicit get/set operators which are not visible to
callers. (good or bad, depending upon your opinion)
5. switch statements can use strings (as opposed to the old 'Randall
maneuver ' of using weakly hased cases like  case 'J'+'A'+'N')

>(well, to be honest,
> only one thing "class versioning" which is something I'd expect the JCP
> to talk about soon).

The versioning thing is actually incomplete in C# , despite its claims. The
versioning, as in COM, exists only to ensure interface compliance.
Versioning is also about implementation compliance. Given that most of the
system admin features in win2K related to DLL hell are effectively about
versioning COM libraries, one would have expected more from the langage.

Also, if VB is anything to go by, each version of the language adds new
reserved words, which kind of breaks everything if you were unlucky in your
choice of identifiers.

> </rant>

> And if it takes 2 years to get assertions and 5 years to get aspects
> into the language but only engineering and technical reasons drive that
> R&D period, I'm totally fine with that.

I suspect the battle will be less on pure language than on ease of
development and deployment. Right now java has the edge on both counts. The
C# spec does not cover those. Tools like ant, tomcat etc can help keep C#
down.

The most amusing thing, when you think of it, is that MS, bastion of VB and
the largest commercial vendor of Windows C++ compilers has effectivey
admitted that neither of them cut it in the web world -one too hard, one too
cheesy. Does C# spell an end to Win32 API, MFC and ATL? we shall have to
see.

Now, to get back to something ant related I've attached in my own Touch
task, which I'm not happy with as it does not do what I really want:-
    -take in a list of files
    -take a timestamp from a) another file b) remote sources and c) text
parameters
It probably raises an exception on jdk1.1, but I havent tested that.

    -Steve

// ====================================================================
/* Stevo's first ant task, done mostly for learning
	$Header: $
*/
// ====================================================================

// ====================================================================
// package
// ====================================================================
package com.iseran.ant_tasks;

// ====================================================================
// imports
// ====================================================================

import org.apache.tools.ant.*;
import java.io.*;
import java.util.*;
import java.text.*;

// ====================================================================
/**
	Touch task for ant.
	Uses the Java 1.2 File.setModified() call, so does not work on 
	earlier platforms. Also note that some file systems (i.e. FAT) 
	have very loose timestamp rules (FAT is only accurate to a second
	or two). This can cause confusion.
	<p>
	Touch has one property: touchFile, which is the file to touch.
	A timestamp may be a future option. 
	@author Steve Loughran [EMAIL PROTECTED]
	@version 0.0
*/
// ====================================================================

public class Touch
	 extends Task 
{
/** datestamp for the touch. Usually generated automatically,
	but can in future be defined in the task arguments
*/
protected long timestamp=-1;

/** touchFile file to touch
*/

protected String touchFile;

/** internal debug flag
*/

static protected final boolean bDebug=true;


// ====================================================================
/** init routine.
	sets up the datestamp variable
	*/
// ====================================================================
	
public void init() throws BuildException 
	{
    try {
        if(bDebug)
        	{
            logVerbose("Touch class loading");
            }
            
    	}
     catch (Exception e) 
	    {
        throw new BuildException(e);
    	}
	}

// ====================================================================
 /**
 * Touches the file. Creates the file if it does not exist.
 * This method is split off from execute so that a future
 * version of the task can act on multiple files
 * pre: system is java1.2 or later.
 * pre: user has write access to the file and/or directory
 * pre: path is not a null or empty string
 * post: file exists and is touched.
 * @exception BuildException if someting goes wrong with the build
 */
// ====================================================================

protected void touchFile(String path)
	throws BuildException  
	{
	//so now we touch the file. What if there is none? a null
	//file gets created then the timestamp is applied to it.

	try 
		{
		File file=new File(path);
		if(!file.exists())
			{
			file.createNewFile();
			}
		
		//touch process is a Java1.2 API call
		file.setLastModified(timestamp);
		
		}
	catch(Exception e)
		{ //will probably get here in Java1.1
        throw new BuildException(e);
		}
	}
	
	
// ====================================================================
/**
* Touches the file
* pre: nothing (except on java1.1 or later)
* post: files are touched
* @exception BuildException if someting goes wrong with the build
*/
// ====================================================================

public void execute() throws BuildException 
	{
	
    if (touchFile == null || touchFile.length()==0) 
    	{
        logError("touch file is not defined");
        return;            
	    }
	    
	    //if the timestamp is not defined, grab it now
	if(timestamp<=0)
		{
        timestamp = System.currentTimeMillis();
        }
        
        //print a log entry 
	SimpleDateFormat when  = new SimpleDateFormat
		 ("yyyy-MM-dd HH:mm:ss", Locale.US);
	String stamp=when.format(new Date(timestamp));
	logVerbose("Touch " + touchFile+" <- "+stamp);

		//touch the file
 	touchFile(touchFile);
	
	}


// ====================================================================
/**
* Set the touchFile file.
*/
// ====================================================================
     
public void setFile(String file) 
	{
	touchFile = project.translatePath(file);
	}
	
/** add to the text log. If there is no project defined,
	as in the main() invocation, then print to the console
* @param message
* @param level
*/

public void log(String msg,int level)
	{
	if(project!=null)
		project.log(msg,level);
	else
		System.out.println(msg);
	}
	
	
/** verbose text log
*/
public void logVerbose(String msg)
	{
	log(msg,Project.MSG_VERBOSE);
	}
        
/** error text log
*/
public void logError(String msg)
	{
	log(msg,Project.MSG_ERR);
	}


// ====================================================================
/** test harness to QA base functionality outside of ANT
* there is no project defined here, so some functions break. 
* but the basic 'touch' operation can be verified.
*/
// ====================================================================

static public void main(String args[])
	{
	if(args.length==0)
		{
		System.out.println("Usage: touch file");
		}
	

	Touch touch=new Touch();
	touch.init();
		//force it in as the indirect assignment method
		//depends on project!=null
	touch.touchFile=args[0];
	touch.execute();	    
	}
	
	
} //end class


/* Touch.java */

Reply via email to