ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jose Alberto Fernandez <jofer...@us.oracle.com>
Subject Re: What flavour of scripting?
Date Tue, 29 Feb 2000 20:13:24 GMT


rubys@us.ibm.com wrote:

> Stefano wrote:
> > Considering that the scripting guru we have on this list (in case you
> > didn't know, Sam is responsible of the ECMAScript specification process
> > and author of BSF, a framework that adds hooks between java and tons of
> > scripting languages) I would like to hear him :)
>
> In case you hadn't noticed, I *have* been participating in this
> conversation!
>
> Recap of my thoughts on the subject so far: I believe that conditional
> processing and iteration are valid requirements.  This, however, does not
> mean that I believe that they should be implemented as tasks.  Wildcards,
> recursion, and if/unless attributes are all valid ways of addressing these
> needs.
>

There are two alternatives for this kind of thing:
(1) Make them tasks, which means allow enough liberty of the xml framework to
     allow them to be defined. E.g., properties could be passed as arguments, a
way to
     have substaks, etc.

(2) Make this things parts of the Ant's concepts. Just like <taskdef ...> or
<project ...>
     so they are predefine with a very restricted capability and that is all
what one has.

(3) The third new alternative is to go the scripting way we have you mentioned
below,
     more on that later.

>
> In fact, I'm mildly against having a <foreach> task as it forces is to
> examine the shortcomings of the existing tasks.
>
> Furthermore, I believe that properties should be variables, there should be
> additional and simpler means to register new tasks than the current
> properties file, and that there should be a means to pass text and/or cdata
> to objects configured by Ant.
>
> Given this support, support for a <script language="JavaScript"> task is
> trivial to implement with BSF.  Furthermore, at the same time you get
> access to a number of other languages, including all the ones I've heard
> mentioned so far.  I could imagine that this could be handy in much the
> same way that JavaScript is handy inside of HTML - special case one to six
> line programs tailored to a specific need.  Of course, this support should
> be conditionally compiled into Ant based on the presence of bsf in your
> classpath ;-)
>

I like the idea of allowing other languages besides Java. It opens things up.
I do not think we should treat scripting languages in any special way. For
that I propose just extend <taskdef ...> to allow for other languajes.

<taskdef ... language="javascript" src="file.js" />
That just says the task is defined using javascript instead of Java and
its sources is in a separate file.

The default value for language is java, for src is the body of the taskdef
if any. Other atributes which are language specific can be passed also.

Notice that this more general facility, could allow in the future to define
the java code for a task in src form and the taskdef should be able to process
it simillar to the way JSPs work.

This would mean reorganizing the taskdef code in two parts, a topclass
that only understands generically what a taskdef is and language specific
classes that are loaded in order to process the definition.

Comments....

>
> I'm just reticent to proceed with all the -1's flying around.
>
> - Sam Ruby

--
  ------------------------------------------------------------------------
 Jose Alberto Fernandez               500 Oracle Parkway, M/S 9op4
 Development Manager                  Redwood Shores, CA 94065
 ORACLE Corp.                         Phone: (650) 506-8830
 Java Products Group                  Fax: (650) 506-7303
 Languages & Obj-Relational Tech      Email: jofernan@us.oracle.com


Mime
View raw message