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

Reply via email to