Which conflicts with what is there right now. As it there is automatically a class and the minimum you need to add is a ScriptMain as in the example at:
http://nant.sourceforge.net/nightly/help/tasks/script.html


forcing the user to *have* to specify class and namespace is going too far I think.

you can define many functions and classes all in the same <script/> *now*. The 2nd form - with just the function body inside the script tag looks kinds confusing to me - you'd still need to specify input params to the function somewhere - why not just use the c# syntax and let the compiler handle all that.

Ian

Scott Hernandez wrote:

I'd lean the other way and require that the script be basically a full
namespace/class def. (or no function decl. at all).

<script language="C#">
   namespace test {
   [FunctionSet("test", "Test")]
   class myFuncs : FunctionSetBase  {
    [Function("test-func")]
    public string Testfunc(  ) {
        return "some result !!!!!!!!";
    }}}
</script>

or

<script language="C#" function="Testfunc">
       return "some result !!!!!!!!";
</script>

Then all of the <script function="*"/> scripts could be combined for a
project, or you could define many functions and classes all in the same
<script/>.

----- Original Message ----- From: "Jaroslaw Kowalski" <[EMAIL PROTECTED]>
To: "Ian MacLean" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Wednesday, January 07, 2004 7:45 AM
Subject: Re: [nant-dev] custom functions with the script task





Nice.

I also though about it some time ago. Wouldn't it be cleaner to write it
like the following?

<script language="C#" definefunctions="true" namespace="test">
   [Function("test-func")]
   public string Testfunc(  ) {
       return "some result !!!!!!!!";
   }
</script>

Most parts of the script code are constant, anyway. The parts could be


added


automatically by the <script> task.
I also think that we shouldn't require the user to provide "Function"
attributes here. We'd just take all public functions and add them to the
TypeFactory. [Function] could be used to override the default name here.

Jarek

----- Original Message ----- From: "Ian MacLean" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 07, 2004 4:31 PM
Subject: [nant-dev] custom functions with the script task





I just committed a small change to ScriptTask to allow the definition of
custom functions inside a <script> task instance - see example below:
This is quite nice as it means people can easily prototype new functions
without having to compile and load a dedicated task/function assembly.
Note that the script still requires a ScriptMain even if its empty.

    <script language="C#">
           <code><![CDATA[
           public static void ScriptMain(Project project) {

           }
           [FunctionSet("test", "Test")]
           public class TestFunctions : FunctionSetBase {

               public TestFunctions(Project project, PropertyDictionary
propDict) : base(project, propDict) {
               }
               [Function("test-func")]
               public static string Testfunc(  ) {
                   return "some result !!!!!!!!";
               }
           }

]]></code>
</script>
<echo message="${test::test-func()}" />





-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
nant-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-developers




--
Ian MacLean, Developer, ActiveState, a division of Sophos
http://www.ActiveState.com




-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
nant-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-developers

Reply via email to