Re: [nant-dev] custom functions with the script task

2004-01-08 Thread Jaroslaw Kowalski
 OK - I think we can do without the definefunctions attribute though. 
 I'll just make the implicit script class a FunctionSet behind the scenes 
 and remove the constraint that you have to have a ScriptMain.

What about the namespace?

Jarek


---
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


Re: [nant-dev] custom functions with the script task

2004-01-08 Thread Ian MacLean
I think add the namespace attribute but make it non-required. Just the 
global namespace if its present. Since none of the built-in functions 
reside in the global namespace that shouldn't be a problem.

Ian

OK - I think we can do without the definefunctions attribute though. 
I'll just make the implicit script class a FunctionSet behind the scenes 
and remove the constraint that you have to have a ScriptMain.
   

What about the namespace?

Jarek
 



--
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


Re: [nant-dev] custom functions with the script task

2004-01-08 Thread Jaroslaw Kowalski
 I think add the namespace attribute but make it non-required. Just the
 global namespace if its present. Since none of the built-in functions
 reside in the global namespace that shouldn't be a problem.

I'm afraid there's no global namespace ;-( And parser does rely on the fact
that every function is prefix::function-name()...

Jarek



---
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


Re: [nant-dev] custom functions with the script task

2004-01-08 Thread Rodrigo B. de Oliveira
Or, it could default to something like globals (globals::my-function()).

Anyway this expression thing is very good stuff... Thanks.

Rodrigo

- Original Message - 
From: Ian MacLean [EMAIL PROTECTED]
To: Jaroslaw Kowalski [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Thursday, January 08, 2004 6:09 AM
Subject: Re: [nant-dev] custom functions with the script task


 Oh really ? ok in that case the namespace attribute will be required.
 Ian
 Jaroslaw Kowalski wrote:

 I think add the namespace attribute but make it non-required. Just the
 global namespace if its present. Since none of the built-in functions
 reside in the global namespace that shouldn't be a problem.
 
 
 
 I'm afraid there's no global namespace ;-( And parser does rely on the
fact
 that every function is prefix::function-name()...
 
 Jarek
 
 




---
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


Re: [nant-dev] custom functions with the script task

2004-01-08 Thread Ian MacLean
The only problem with an implied namespace like that is making it clear 
to the user that thats the namespace he/she will need to use.  Maybe 
clear documentation will be enough.

Ian
Jaroslaw Kowalski wrote:
How about local ? (local to the build file).

Jarek
- Original Message - 
From: Rodrigo B. de Oliveira [EMAIL PROTECTED]
To: Ian MacLean [EMAIL PROTECTED]; Jaroslaw Kowalski
[EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Thursday, January 08, 2004 2:06 PM
Subject: Re: [nant-dev] custom functions with the script task

 

Or, it could default to something like globals (globals::my-function()).

Anyway this expression thing is very good stuff... Thanks.

Rodrigo

- Original Message - 
From: Ian MacLean [EMAIL PROTECTED]
To: Jaroslaw Kowalski [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Thursday, January 08, 2004 6:09 AM
Subject: Re: [nant-dev] custom functions with the script task

   

Oh really ? ok in that case the namespace attribute will be required.
Ian
Jaroslaw Kowalski wrote:
 

I think add the namespace attribute but make it non-required. Just the
global namespace if its present. Since none of the built-in functions
reside in the global namespace that shouldn't be a problem.
 

I'm afraid there's no global namespace ;-( And parser does rely on the
   

fact
   

that every function is prefix::function-name()...

Jarek

   



---
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


Re: [nant-dev] custom functions with the script task

2004-01-07 Thread Jaroslaw Kowalski
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()} /
 ...

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



 ---
 This SF.net email is sponsored by: IBM Linux Tutorials.
 Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
 Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
 Click now! http://ads.osdn.com/?ad_id=1278alloc_id=3371op=click
 ___
 nant-developers mailing list
 [EMAIL PROTECTED]
 https://lists.sourceforge.net/lists/listinfo/nant-developers




---
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


Re: [nant-dev] custom functions with the script task

2004-01-07 Thread Ian MacLean
that should be doable. The class would automatically have the 
FunctionSet attribute added if definefunctions was true.

but what if you actually wanted to use the constructor to do somthing ? 
With the longer format it would be easier to copy your function code out 
when you get around to making a proper assembly for it.

Ian

Jaroslaw Kowalski wrote:

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()} /
...
--
Ian MacLean, Developer,
ActiveState, a division of Sophos
http://www.ActiveState.com


---
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278alloc_id=3371op=click
___
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


Re: [nant-dev] custom functions with the script task

2004-01-07 Thread Scott Hernandez
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


Re: [nant-dev] custom functions with the script task

2004-01-07 Thread Jaroslaw Kowalski
 script language=C# function=Testfunc
 return some result ;
 /script

That can't be done because you need the type information for formal
parameters and returned value.

Jarek



---
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


Re: [nant-dev] custom functions with the script task

2004-01-07 Thread Ian MacLean
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