[Users] Autoreply: Users Digest, Vol 36, Issue 35

2007-07-23 Thread aranguren
I am on holiday till the 3th of August and won't be able to reply to your 
email. For any urgent matters please contact Laura Senent at [EMAIL PROTECTED]



-
This transmission (including any attachments) may contain confidential 
information, privileged material (including material protected by the 
solicitor-client or other applicable privileges), or constitute non-public 
information. Any use of this information by anyone other than the intended 
recipient is prohibited. If you have received this transmission in error, 
please immediately reply to the sender and delete this information from your 
system. Use, dissemination, distribution, or reproduction of this transmission 
by unintended recipients is not authorized and may be unlawful



___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [Users] [IronPython] IronPython Attribute Workaround

2007-07-23 Thread Tim Riley
Michael:

Earlier today I was doing some digging using Lutz Roeder's .NET
Reflector and it seems that the CommandMethod attribute registers the
command using the acmgd.Autodesk.AutoCAD.Runtime.ICommandLineCallable
interface. As I can tap into any other aspect of AutoCAD's .NET api
via ironpython I'm going to assume that I can somehow tap into this
and register a command. The only problem is I don't have a clue
how...yet.

If you want to take a look at what C# code I have so far you can find
it @ http://pyacaddotnet.googlecode.com/svn/trunk/PyAcadDotNet.cs

Also I have some (lousy) samples that I use for testing IronPython in
AutoCAD. You can find them here:
http://pyacaddotnet.googlecode.com/svn/trunk/Samples/

Tim

On 7/23/07, Michael Foord <[EMAIL PROTECTED]> wrote:
> I'm pretty sure that it is impossible to dynamically generate classes
> decorated with attributes at runtime using 'pure C#'.
>
> The two alternatives are either to use the Reflection.Emit API - which
> is probably the best way but requires more digging than I have time for
> at this point in time.
>
> Another alternative is to dynamically generate C# and compile to in
> memory assemblies. This is less memory efficient because it requires an
> assembly and type object for every command you wish to add. It is a lot
> faster than you might expect.
>
> Attached are two files. One is 'generate.py'. It has a function called
> 'Generate' which compiles C# using the CodeDom API with the
> CSharpCodeProvider.
>
> As an example I have provided another file - DllImport.py. This uses
> Generate to compile the C# from my screenshot example :
>
> http://www.voidspace.org.uk/ironpython/winforms/part10.shtml
>
> It works fine. :-)
>
> The specific call is :
>
> assembly = Generate(unmanaged_code, 'UnamangedCode', inMemory=True)
> clr.AddReference(assembly)
> from UnmanagedCode import User32, GDI32
>
> (You can also use it to save assemblies to disk.)
>
> For your use you will need to pass in a list of references (absolute
> file paths) to the AutoCAD DLLs that your C# code is dependent on.
>
> I think you need to generate C# code that looks something like:
>
>
> using Autodesk.AutoCAD.ApplicationServices;
> using Autodesk.AutoCAD.DatabaseServices;
> using Autodesk.AutoCAD.EditorInput;
> using Autodesk.AutoCAD.Runtime;
>
> namespace AutoCADStuff
>
> {
>   public class AutoCADStuffBase
>   {
> [CommandMethod("myname")]
> public void method
> {
>_method();
> }
>
> public virtual void _method
> {
>return null;
> }
> }
>
> In IronPython you can call 'Generate', then import and subclass
> AutoCADStuffBase and override '_method':
>
> class AutoCADStuff(AutoCADStuffBase):
> def _method(self):
>some code ...
>
> I have used this approach with Silverlight assemblies for creating
> classes with methods marked with attributes.
>
> I hope this helps.
>
> Please no one post this code as is - I'll write up and post an article
> shortly. :-)
>
> Michael Foord
>
> Michael Foord wrote:
> > Tim Riley wrote:
> > [snip..]
> >
> >>  AutoCAD's .NET API allows
> >> you to register a command that is callable from the AutoCAD via a 
> >> CommandMethod attribute[1]. Since IP doesn't support attributes I'd like 
> >> to develop some sort of decorator that would clone the functionality of 
> >> the CommandMethod attribute. So I could execute
> >> python code like:
> >>
> >> @commandmethod("test")
> >> def tester:
> >> print "test worked"
> >>
> >> and it would register the test command so  I could call it from the
> >> command line.
> >>
> >>
> >>
> >
> > Right - so you want to dynamically create  methods (or functions) with
> > attributes. The attribute takes the name that the command will be
> > exposed with.
> >
> > I wonder if AutoCAD even supports these being dynamically created?
> >
> > If it does I wonder if we can do it by creating an inner class in C#.
> > The method marked with the attribute would call down to another method
> > (marked as virtual) that we can override from IronPython.
> >
> > I'm not exactly sure of the C# syntax/semantics for inner classes - (a
> > class factory) - so I'll have to do some digging. (i.e. will it allow us
> > to set the argument to the attribute at runtime rather than compile time
> > and can we return classes or only instances.)
> >
> > AFAIK, attributes are normally bound at compile time rather than
> > runtime, so using C# to create classes in this way may not work.
> >
> > The proper way (*sigh*) is to use the Reflection.Emit API to add
> > attributes. I've experimented Reflection.Emit - but never got as far as
> > adding attributes dynamically. (You need to 'program in bytecode' using
> > this API - which isn't too bad but has a bit of a learning curve
> > associated.)
> >
> > A *third* approach is to dynamically generate C# and compile to in
> > memory assemblies (using the CodeDOM API if I remember correctly). That
> > turns out to be surprisingly easy.
> >
> > Michael Foord

Re: [Users] Mailing List Archives Gone Private ?

2007-07-23 Thread John Messerly
I'm sure it was accidental :). I'll see if I can get someone to fix it.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Michael Foord
Sent: Monday, July 23, 2007 6:35 PM
To: Discussion of IronPython
Subject: Re: [Users] Mailing List Archives Gone Private ?

Steve Holden wrote:
> Michael Foord wrote:
>
>> Hello all,
>>
>> It seems like the archive for this mailing list just became private... wtf?
>>
>> If you go to the list page:
>>
>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>>
>> and click on the archives link, it takes you to a sign-in page and is
>> now for subscribers only.
>>
>> That means that it won't be indexed by google and we can't search it...
>>
>> I'm sure this is a mistake - unintended consequence of a mailman upgrade
>> perhaps?
>>
>>
> As a new subscriber I see that the messages from this list appear with
> the rather unhelpful list designation "[Users]" in the subject line. It
> may be too late to amend this now everyone already joined up has set
> their filters appropriately, but "[IronPython Users]" would be much more
> user-friendly (and slightly less egocentric ;-)
>

It *was* set to [IronPython] - but changed at the same time that the
archive went private.

Looks like another error. As a result people's filters *are* now broken
and we're getting spammed with auto-responders... :-)

Michael

> regards
>   Steve
>
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [Users] Mailing List Archives Gone Private ?

2007-07-23 Thread Michael Foord
Steve Holden wrote:
> Michael Foord wrote:
>   
>> Hello all,
>>
>> It seems like the archive for this mailing list just became private... wtf?
>>
>> If you go to the list page:
>>
>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>>
>> and click on the archives link, it takes you to a sign-in page and is 
>> now for subscribers only.
>>
>> That means that it won't be indexed by google and we can't search it...
>>
>> I'm sure this is a mistake - unintended consequence of a mailman upgrade 
>> perhaps?
>>
>> 
> As a new subscriber I see that the messages from this list appear with 
> the rather unhelpful list designation "[Users]" in the subject line. It 
> may be too late to amend this now everyone already joined up has set 
> their filters appropriately, but "[IronPython Users]" would be much more 
> user-friendly (and slightly less egocentric ;-)
>   

It *was* set to [IronPython] - but changed at the same time that the 
archive went private.

Looks like another error. As a result people's filters *are* now broken 
and we're getting spammed with auto-responders... :-)

Michael

> regards
>   Steve
>   

___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [Users] Mailing List Archives Gone Private ?

2007-07-23 Thread Simon Burton

It used to be [IronPython], can we change it back?

Simon.

On Mon, 23 Jul 2007 21:32:48 -0400
Steve Holden <[EMAIL PROTECTED]> wrote:

> Michael Foord wrote:
> > Hello all,
> > 
> > It seems like the archive for this mailing list just became private... wtf?
> > 
> > If you go to the list page:
> > 
> > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> > 
> > and click on the archives link, it takes you to a sign-in page and is 
> > now for subscribers only.
> > 
> > That means that it won't be indexed by google and we can't search it...
> > 
> > I'm sure this is a mistake - unintended consequence of a mailman upgrade 
> > perhaps?
> > 
> As a new subscriber I see that the messages from this list appear with 
> the rather unhelpful list designation "[Users]" in the subject line. It 
> may be too late to amend this now everyone already joined up has set 
> their filters appropriately, but "[IronPython Users]" would be much more 
> user-friendly (and slightly less egocentric ;-)
> 
> regards
>   Steve
> -- 
> Steve Holden+1 571 484 6266   +1 800 494 3119
> Holden Web LLC/Ltd   http://www.holdenweb.com
> Skype: holdenweb  http://del.icio.us/steve.holden
> --- Asciimercial --
> Get on the web: Blog, lens and tag the Internet
> Many services currently offer free registration
> --- Thank You for Reading -
> ___
> Users mailing list
> Users@lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [Users] Mailing List Archives Gone Private ?

2007-07-23 Thread Steve Holden
Michael Foord wrote:
> Hello all,
> 
> It seems like the archive for this mailing list just became private... wtf?
> 
> If you go to the list page:
> 
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> 
> and click on the archives link, it takes you to a sign-in page and is 
> now for subscribers only.
> 
> That means that it won't be indexed by google and we can't search it...
> 
> I'm sure this is a mistake - unintended consequence of a mailman upgrade 
> perhaps?
> 
As a new subscriber I see that the messages from this list appear with 
the rather unhelpful list designation "[Users]" in the subject line. It 
may be too late to amend this now everyone already joined up has set 
their filters appropriately, but "[IronPython Users]" would be much more 
user-friendly (and slightly less egocentric ;-)

regards
  Steve
-- 
Steve Holden+1 571 484 6266   +1 800 494 3119
Holden Web LLC/Ltd   http://www.holdenweb.com
Skype: holdenweb  http://del.icio.us/steve.holden
--- Asciimercial --
Get on the web: Blog, lens and tag the Internet
Many services currently offer free registration
--- Thank You for Reading -
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[Users] Mailing List Archives Gone Private ?

2007-07-23 Thread Michael Foord
Hello all,

It seems like the archive for this mailing list just became private... wtf?

If you go to the list page:

http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

and click on the archives link, it takes you to a sign-in page and is 
now for subscribers only.

That means that it won't be indexed by google and we can't search it...

I'm sure this is a mistake - unintended consequence of a mailman upgrade 
perhaps?

Michael Foord
http://www.voidspace.org.uk/ironpython/index.shtml
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[Users] Dynamically Compiling C# from IronPython

2007-07-23 Thread Michael Foord
Hello all,

I've written up an article on dynamically compiling C# from IronPython.

http://www.voidspace.org.uk/ironpython/dynamically_compiling.shtml

Assemblies can be generated in memory and then used directly, or they 
can be saved to disk. The C# can be generated dynamically as well.

This is one way round the lack of attributes support in IronPython. 
Perhaps not the most efficient way though...

Michael Foord
http://www.voidspace.org.uk/ironpython/index.shtml
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[Users] Autoreply: Users Digest, Vol 36, Issue 34

2007-07-23 Thread aranguren
I am on holiday till the 3th of August and won't be able to reply to your 
email. For any urgent matters please contact Laura Senent at [EMAIL PROTECTED]



-
This transmission (including any attachments) may contain confidential 
information, privileged material (including material protected by the 
solicitor-client or other applicable privileges), or constitute non-public 
information. Any use of this information by anyone other than the intended 
recipient is prohibited. If you have received this transmission in error, 
please immediately reply to the sender and delete this information from your 
system. Use, dissemination, distribution, or reproduction of this transmission 
by unintended recipients is not authorized and may be unlawful



___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[Users] Autoreply: Users Digest, Vol 36, Issue 33

2007-07-23 Thread aranguren
I am on holiday till the 3th of August and won't be able to reply to your 
email. For any urgent matters please contact Laura Senent at [EMAIL PROTECTED]



-
This transmission (including any attachments) may contain confidential 
information, privileged material (including material protected by the 
solicitor-client or other applicable privileges), or constitute non-public 
information. Any use of this information by anyone other than the intended 
recipient is prohibited. If you have received this transmission in error, 
please immediately reply to the sender and delete this information from your 
system. Use, dissemination, distribution, or reproduction of this transmission 
by unintended recipients is not authorized and may be unlawful



___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [Users] [IronPython] IronPython Attribute Workaround

2007-07-23 Thread Michael Foord
I'm pretty sure that it is impossible to dynamically generate classes 
decorated with attributes at runtime using 'pure C#'.


The two alternatives are either to use the Reflection.Emit API - which 
is probably the best way but requires more digging than I have time for 
at this point in time.


Another alternative is to dynamically generate C# and compile to in 
memory assemblies. This is less memory efficient because it requires an 
assembly and type object for every command you wish to add. It is a lot 
faster than you might expect.


Attached are two files. One is 'generate.py'. It has a function called 
'Generate' which compiles C# using the CodeDom API with the 
CSharpCodeProvider.


As an example I have provided another file - DllImport.py. This uses 
Generate to compile the C# from my screenshot example :


http://www.voidspace.org.uk/ironpython/winforms/part10.shtml

It works fine. :-)

The specific call is :

assembly = Generate(unmanaged_code, 'UnamangedCode', inMemory=True)
clr.AddReference(assembly)
from UnmanagedCode import User32, GDI32

(You can also use it to save assemblies to disk.)

For your use you will need to pass in a list of references (absolute 
file paths) to the AutoCAD DLLs that your C# code is dependent on.


I think you need to generate C# code that looks something like:


using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Runtime;

namespace AutoCADStuff

{
 public class AutoCADStuffBase
 {
   [CommandMethod("myname")]
   public void method
   {
  _method();
   }

   public virtual void _method
   {
  return null;
   }
}

In IronPython you can call 'Generate', then import and subclass 
AutoCADStuffBase and override '_method':


class AutoCADStuff(AutoCADStuffBase):
   def _method(self):
  some code ...

I have used this approach with Silverlight assemblies for creating 
classes with methods marked with attributes.


I hope this helps.

Please no one post this code as is - I'll write up and post an article 
shortly. :-)


Michael Foord

Michael Foord wrote:

Tim Riley wrote:
[snip..]
  

 AutoCAD's .NET API allows
you to register a command that is callable from the AutoCAD via a CommandMethod 
attribute[1]. Since IP doesn't support attributes I'd like to develop some sort 
of decorator that would clone the functionality of the CommandMethod attribute. 
So I could execute
python code like:

@commandmethod("test")
def tester:
print "test worked"

and it would register the test command so  I could call it from the
command line.

  



Right - so you want to dynamically create  methods (or functions) with 
attributes. The attribute takes the name that the command will be 
exposed with.


I wonder if AutoCAD even supports these being dynamically created?

If it does I wonder if we can do it by creating an inner class in C#. 
The method marked with the attribute would call down to another method 
(marked as virtual) that we can override from IronPython.


I'm not exactly sure of the C# syntax/semantics for inner classes - (a 
class factory) - so I'll have to do some digging. (i.e. will it allow us 
to set the argument to the attribute at runtime rather than compile time 
and can we return classes or only instances.)


AFAIK, attributes are normally bound at compile time rather than 
runtime, so using C# to create classes in this way may not work.


The proper way (*sigh*) is to use the Reflection.Emit API to add 
attributes. I've experimented Reflection.Emit - but never got as far as 
adding attributes dynamically. (You need to 'program in bytecode' using 
this API - which isn't too bad but has a bit of a learning curve 
associated.)


A *third* approach is to dynamically generate C# and compile to in 
memory assemblies (using the CodeDOM API if I remember correctly). That 
turns out to be surprisingly easy.


Michael Foord
http://www.voidspace.org.uk/ironpython/index.shtml

  

[1] As an example:
http://through-the-interface.typepad.com/through_the_interface/2007/07/updating-a-spec.html


Tim

On 7/23/07, Michael Foord <[EMAIL PROTECTED]> wrote:
  


Tim Riley wrote:

  

Michael:

Thanks for the reply. However when reading it my eyes glazed over. Is
there any way you could provide a simple man like myself with some
example code for me to peruse?

  


What do you want to achieve? Write the IronPython code you would like -
and I will try and provide a C# stub that you can subclass. (You will
need a C# compiler - Visual Studio Express C# is probably the most
straightforward if you are using Windows.)

Michael Foord
http://www.voidspace.org.uk/ironpython/index.shtml


  

Tim

On 7/23/07, Michael Foord <[EMAIL PROTECTED]> wrote:

  


Tim Riley wrote:


  

I know that IronPython doesn't support attributes but does anyone know
of a workaround that will allow IP code to use them?


  


The Iro

Re: [IronPython] Contributions to IronPython library source

2007-07-23 Thread Michael Foord
Thanks Jim - this is *great* news.

Even if it doesn't happen immediately, the announcement that it is a 
definite goal is very reassuring and appreciated.

All the best,

Michael Foord
http://www.voidspace.org.uk/ironpython/index.shtml

Jim Hugunin wrote:
> John Lam announced this morning that we will be accepting external source 
> code contributions into the IronRuby libraries on the standard Ruby open 
> source site, Rubyforge.  In the hours since that announcement a number of 
> people (including Mark, below) have asked if we're going to do the same thing 
> with the IronPython libraries.  Obviously the answer to that question is an 
> enthusiastic yes!  However, we still have work to do to figure out the 
> details and the timing.
>
> In one sense, we already have such a site for IronPython with the fepy 
> project run by Seo Sanghyeon.  This sourceforge project includes many 
> community contributions primarily in the form of libraries that are not a 
> part of the core IronPython release.  Seo also produces very nice complete 
> packages of IronPython and related libraries - particularly for folks running 
> on Linux.  If you're an eager contributor today who'd like to improve 
> IronPython's library support, I suspect that your contributions would be 
> welcome at fepy - although you'd obviously have to ask Seo for a definitive 
> answer here.
>
> In the longer term, we will establish a more official structure so that the 
> community can contribute to more of the IronPython project and so that our 
> "official" releases will include these contributions.  Right now, our fairly 
> small team is still focused on working out the details for our new IronRuby 
> release.  While we're doing this, we don't want to make any changes to 
> disrupt the IronPython project that has been running successfully for over 
> two years.  After the IronRuby sources do in fact go up on Rubyforge, we'll 
> be able to devote the time to talk with folks both within MS and within the 
> Python community to work out the best next step for IronPython to increase 
> our support for community contributors.  I'm sorry this is going to take a 
> little more time and thank you for your patience.
>
> Thanks - Jim
>
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mark Rees
> Sent: Monday, July 23, 2007 6:25 AM
> To: Discussion of IronPython
> Subject: [IronPython] Contributions to IronPython library source
>
> Hi,
>
> I see in John Lams announcement of the IronRuby first source code
> release (http://www.iunknown.com/2007/07/a-first-look-at.html), they
> will be accepting source code contributions into the IronRuby
> libraries. So I cannot resist asking if the IronPython will have the
> same policy soon for IronPython 2.0 libraries and hopefully IronPython
> 1.1.
>
> Regards
>
> Mark
> ___
> users mailing list
> users@lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> ___
> Users mailing list
> Users@lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>   

___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Contributions to IronPython library source

2007-07-23 Thread Jim Hugunin
John Lam announced this morning that we will be accepting external source code 
contributions into the IronRuby libraries on the standard Ruby open source 
site, Rubyforge.  In the hours since that announcement a number of people 
(including Mark, below) have asked if we're going to do the same thing with the 
IronPython libraries.  Obviously the answer to that question is an enthusiastic 
yes!  However, we still have work to do to figure out the details and the 
timing.

In one sense, we already have such a site for IronPython with the fepy project 
run by Seo Sanghyeon.  This sourceforge project includes many community 
contributions primarily in the form of libraries that are not a part of the 
core IronPython release.  Seo also produces very nice complete packages of 
IronPython and related libraries - particularly for folks running on Linux.  If 
you're an eager contributor today who'd like to improve IronPython's library 
support, I suspect that your contributions would be welcome at fepy - although 
you'd obviously have to ask Seo for a definitive answer here.

In the longer term, we will establish a more official structure so that the 
community can contribute to more of the IronPython project and so that our 
"official" releases will include these contributions.  Right now, our fairly 
small team is still focused on working out the details for our new IronRuby 
release.  While we're doing this, we don't want to make any changes to disrupt 
the IronPython project that has been running successfully for over two years.  
After the IronRuby sources do in fact go up on Rubyforge, we'll be able to 
devote the time to talk with folks both within MS and within the Python 
community to work out the best next step for IronPython to increase our support 
for community contributors.  I'm sorry this is going to take a little more time 
and thank you for your patience.

Thanks - Jim

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mark Rees
Sent: Monday, July 23, 2007 6:25 AM
To: Discussion of IronPython
Subject: [IronPython] Contributions to IronPython library source

Hi,

I see in John Lams announcement of the IronRuby first source code
release (http://www.iunknown.com/2007/07/a-first-look-at.html), they
will be accepting source code contributions into the IronRuby
libraries. So I cannot resist asking if the IronPython will have the
same policy soon for IronPython 2.0 libraries and hopefully IronPython
1.1.

Regards

Mark
___
users mailing list
users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] IronPython Attribute Workaround

2007-07-23 Thread Michael Foord
Tim Riley wrote:
[snip..]
>  AutoCAD's .NET API allows
> you to register a command that is callable from the AutoCAD via a 
> CommandMethod attribute[1]. Since IP doesn't support attributes I'd like to 
> develop some sort of decorator that would clone the functionality of the 
> CommandMethod attribute. So I could execute
> python code like:
>
> @commandmethod("test")
> def tester:
> print "test worked"
>
> and it would register the test command so  I could call it from the
> command line.
>
>   

Right - so you want to dynamically create  methods (or functions) with 
attributes. The attribute takes the name that the command will be 
exposed with.

I wonder if AutoCAD even supports these being dynamically created?

If it does I wonder if we can do it by creating an inner class in C#. 
The method marked with the attribute would call down to another method 
(marked as virtual) that we can override from IronPython.

I'm not exactly sure of the C# syntax/semantics for inner classes - (a 
class factory) - so I'll have to do some digging. (i.e. will it allow us 
to set the argument to the attribute at runtime rather than compile time 
and can we return classes or only instances.)

AFAIK, attributes are normally bound at compile time rather than 
runtime, so using C# to create classes in this way may not work.

The proper way (*sigh*) is to use the Reflection.Emit API to add 
attributes. I've experimented Reflection.Emit - but never got as far as 
adding attributes dynamically. (You need to 'program in bytecode' using 
this API - which isn't too bad but has a bit of a learning curve 
associated.)

A *third* approach is to dynamically generate C# and compile to in 
memory assemblies (using the CodeDOM API if I remember correctly). That 
turns out to be surprisingly easy.

Michael Foord
http://www.voidspace.org.uk/ironpython/index.shtml

> [1] As an example:
> http://through-the-interface.typepad.com/through_the_interface/2007/07/updating-a-spec.html
>
>
> Tim
>
> On 7/23/07, Michael Foord <[EMAIL PROTECTED]> wrote:
>   
>> Tim Riley wrote:
>> 
>>> Michael:
>>>
>>> Thanks for the reply. However when reading it my eyes glazed over. Is
>>> there any way you could provide a simple man like myself with some
>>> example code for me to peruse?
>>>
>>>   
>> What do you want to achieve? Write the IronPython code you would like -
>> and I will try and provide a C# stub that you can subclass. (You will
>> need a C# compiler - Visual Studio Express C# is probably the most
>> straightforward if you are using Windows.)
>>
>> Michael Foord
>> http://www.voidspace.org.uk/ironpython/index.shtml
>>
>> 
>>> Tim
>>>
>>> On 7/23/07, Michael Foord <[EMAIL PROTECTED]> wrote:
>>>
>>>   
 Tim Riley wrote:

 
> I know that IronPython doesn't support attributes but does anyone know
> of a workaround that will allow IP code to use them?
>
>
>   
 The IronPython team are strangely quiet every time someone asks this... ;-)

 A lot of people would like an answer to this question. Currently the
 only way is to use stub C# classes.

 Michael Foord
 http://www.voidspace.org.uk/ironpython/index.shtml



 
> ___
> users mailing list
> users@lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>
>
>   
 ___
 users mailing list
 users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


 
>>> ___
>>> Users mailing list
>>> Users@lists.ironpython.com
>>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>>>
>>>
>>>   
>> ___
>> Users mailing list
>> Users@lists.ironpython.com
>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>>
>> 
> ___
> Users mailing list
> Users@lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>   

___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] IronPython Attribute Workaround

2007-07-23 Thread Tim Riley
I am messing around with some code that will allow me to use
IronPython to automate AutoCAD software via it's .NET API. I already
have hacked up some ugly C# code that creates an instance of a
PythonEngine and executes a python file a select via an open file
dialog box. All works well with this.

The next step I'd like to take is to attempt to create a mechanism for
registering AutoCAD commands via python code (so I don't have to
select a file every time I want to run it. AutoCAD's .NET API allows
you to register a command that is callable from the AutoCAD via a
CommandMethod attribute[1]. Since IP doesn't support attributes I'd
like to develop some sort of decorator that would clone the
functionality of the CommandMethod attribute. So I could execute
python code like:

@commandmethod("test")
def tester:
print "test worked"

and it would register the test command so  I could call it from the
command line.

[1] As an example:
http://through-the-interface.typepad.com/through_the_interface/2007/07/updating-a-spec.html


Tim

On 7/23/07, Michael Foord <[EMAIL PROTECTED]> wrote:
> Tim Riley wrote:
> > Michael:
> >
> > Thanks for the reply. However when reading it my eyes glazed over. Is
> > there any way you could provide a simple man like myself with some
> > example code for me to peruse?
> >
>
> What do you want to achieve? Write the IronPython code you would like -
> and I will try and provide a C# stub that you can subclass. (You will
> need a C# compiler - Visual Studio Express C# is probably the most
> straightforward if you are using Windows.)
>
> Michael Foord
> http://www.voidspace.org.uk/ironpython/index.shtml
>
> > Tim
> >
> > On 7/23/07, Michael Foord <[EMAIL PROTECTED]> wrote:
> >
> >> Tim Riley wrote:
> >>
> >>> I know that IronPython doesn't support attributes but does anyone know
> >>> of a workaround that will allow IP code to use them?
> >>>
> >>>
> >> The IronPython team are strangely quiet every time someone asks this... ;-)
> >>
> >> A lot of people would like an answer to this question. Currently the
> >> only way is to use stub C# classes.
> >>
> >> Michael Foord
> >> http://www.voidspace.org.uk/ironpython/index.shtml
> >>
> >>
> >>
> >>> ___
> >>> users mailing list
> >>> users@lists.ironpython.com
> >>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> >>>
> >>>
> >>>
> >> ___
> >> users mailing list
> >> users@lists.ironpython.com
> >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> >>
> >>
> > ___
> > Users mailing list
> > Users@lists.ironpython.com
> > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> >
> >
>
> ___
> Users mailing list
> Users@lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] IronPython Attribute Workaround

2007-07-23 Thread Michael Foord
Tim Riley wrote:
> Michael:
>
> Thanks for the reply. However when reading it my eyes glazed over. Is
> there any way you could provide a simple man like myself with some
> example code for me to peruse?
>   

What do you want to achieve? Write the IronPython code you would like - 
and I will try and provide a C# stub that you can subclass. (You will 
need a C# compiler - Visual Studio Express C# is probably the most 
straightforward if you are using Windows.)

Michael Foord
http://www.voidspace.org.uk/ironpython/index.shtml

> Tim
>
> On 7/23/07, Michael Foord <[EMAIL PROTECTED]> wrote:
>   
>> Tim Riley wrote:
>> 
>>> I know that IronPython doesn't support attributes but does anyone know
>>> of a workaround that will allow IP code to use them?
>>>
>>>   
>> The IronPython team are strangely quiet every time someone asks this... ;-)
>>
>> A lot of people would like an answer to this question. Currently the
>> only way is to use stub C# classes.
>>
>> Michael Foord
>> http://www.voidspace.org.uk/ironpython/index.shtml
>>
>>
>> 
>>> ___
>>> users mailing list
>>> users@lists.ironpython.com
>>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>>>
>>>
>>>   
>> ___
>> users mailing list
>> users@lists.ironpython.com
>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>>
>> 
> ___
> Users mailing list
> Users@lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>   

___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] Autoreply: Users Digest, Vol 36, Issue 32

2007-07-23 Thread aranguren
I am on holiday till the 3th of August and won't be able to reply to your 
email. For any urgent matters please contact Laura Senent at [EMAIL PROTECTED]



-
This transmission (including any attachments) may contain confidential 
information, privileged material (including material protected by the 
solicitor-client or other applicable privileges), or constitute non-public 
information. Any use of this information by anyone other than the intended 
recipient is prohibited. If you have received this transmission in error, 
please immediately reply to the sender and delete this information from your 
system. Use, dissemination, distribution, or reproduction of this transmission 
by unintended recipients is not authorized and may be unlawful



___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] IronPython Attribute Workaround

2007-07-23 Thread Tim Riley
Michael:

Thanks for the reply. However when reading it my eyes glazed over. Is
there any way you could provide a simple man like myself with some
example code for me to peruse?

Tim

On 7/23/07, Michael Foord <[EMAIL PROTECTED]> wrote:
> Tim Riley wrote:
> > I know that IronPython doesn't support attributes but does anyone know
> > of a workaround that will allow IP code to use them?
> >
>
> The IronPython team are strangely quiet every time someone asks this... ;-)
>
> A lot of people would like an answer to this question. Currently the
> only way is to use stub C# classes.
>
> Michael Foord
> http://www.voidspace.org.uk/ironpython/index.shtml
>
>
> > ___
> > users mailing list
> > users@lists.ironpython.com
> > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> >
> >
>
> ___
> users mailing list
> users@lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] IronPython Attribute Workaround

2007-07-23 Thread Michael Foord
Tim Riley wrote:
> I know that IronPython doesn't support attributes but does anyone know
> of a workaround that will allow IP code to use them?
>   

The IronPython team are strangely quiet every time someone asks this... ;-)

A lot of people would like an answer to this question. Currently the 
only way is to use stub C# classes.

Michael Foord
http://www.voidspace.org.uk/ironpython/index.shtml


> ___
> users mailing list
> users@lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>   

___
users mailing list
users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] IronPython Attribute Workaround

2007-07-23 Thread Tim Riley
I know that IronPython doesn't support attributes but does anyone know
of a workaround that will allow IP code to use them?
___
users mailing list
users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Future handling of op_Implicit

2007-07-23 Thread Giles Thomas
Thanks, Dino - I've voted on the bug, thanks for pointing me in that 
direction.  It would be great to be able to avoid writing C# for this.


Regards,

Giles

Dino Viehland wrote:
> I believe we're going to get better at this in the future.  For starters 
> there are currently some code paths which are missing the checks for the 
> implicit conversions - for example if you define an implicit conversion to 
> string we won't respect it all (in either v1.x or v2.x right now).  This is 
> because we have a fast path which isn't checking for the implicit conversion.
>
> Additionally it would be fairly easy for us to expose this out via some other 
> mechanism for when we're not doing the right thing.  For example we could 
> either leave the op_Implicit methods on the type which defines them or maybe 
> we could move them onto the type which we want to do the conversion from 
> (e.g. add a "ToFoo" onto Bar when Foo defines an implicit operator for 
> conversion from Foo to Bar).  I believe w/ the 1st option we can get into 
> trouble w/ overloads that only differ by return types but the 2nd option may 
> be less problematic.
>
> But obviously we've got to do a better job of enabling this basic CLS 
> consumption scenario w/o forcing you to use C#.
>
> We've also run into this internally recently as a fundamental DLR concept.  
> That's how we discovered the issues w/ string conversions :).
>
> If you haven't already vote on bug #11278 
> (http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=11278) 
> please do and we'll look at doing this sooner rather than later.
>
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Giles Thomas
> Sent: Thursday, July 05, 2007 8:43 AM
> To: Discussion of IronPython
> Subject: [IronPython] Future handling of op_Implicit
>
> Hi,
>
> I guess we're going to have to use C# to work around the lack of
> op_Implicit support in the short term, but I'm interested in knowing
> about the IP team's plans for handling conversion operators going forward.
>
> Here's our situation; we have a highly-scriptable application, and our
> clients want to be able to call their own .NET libraries from their
> scripts.  However, their libraries make heavy use of the implicit casts,
> so that they can (for example) have a method that takes an instance of
> C1, but pass it a C2 and rely on C1's op_Implicit(C2) to handle the
> conversion.  This works fine for them when using other .NET languages,
> but of course doesn't work in IronPython.
>
> I must admit that I don't really know what IP could do with this kind of
> code; if I understand correctly, op_Implicit(x) in (say) C# is
> dispatched based on the type of the variable x rather then the type of
> the object to which it is a reference, and of course variable type in
> that sense is not a meaningful concept in a dynamic language.
>
> What should IronPython do?  Is this a case where people are going to
> have to write more code if they want to use a dynamic language?
>
>
> Regards,
>
> Giles
> --
>
> Giles Thomas
> [EMAIL PROTECTED]
> +44 (0) 20 7253 6372
>
> Resolver Systems Ltd
> 17a Clerkenwell Road, London EC1M 5RD, UK
> VAT No.: GB 893 5643 79
> Registered in England and Wales as company number 5467329.
> Registered address: 843 Finchley Road, London NW11 8NA, UK
>
> ___
> users mailing list
> users@lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> ___
> users mailing list
> users@lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>   

-- 
Giles Thomas
[EMAIL PROTECTED]
+44 (0) 20 7253 6372

Resolver Systems Ltd
17a Clerkenwell Road, London EC1M 5RD, UK
VAT No.: GB 893 5643 79 
Registered in England and Wales as company number 5467329.
Registered address: 843 Finchley Road, London NW11 8NA, UK

___
users mailing list
users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] .NET Dynamic Languages Group on Facebook

2007-07-23 Thread M. David Peterson

On 7/23/07, Gary Williams <[EMAIL PROTECTED]> wrote:


 The registration page isn't working (This page cannot be
displayed)...unless of course, I'm doing something wrong (a high probability
scenario :))



Facebook registration or the group registration?  Anybody else having
problems?

BTW... I should have included this in the original post to this group, but
the direct link to the group on Facebook is
http://www.facebook.com/group.php?gid=2430928882

--
/M:D

M. David Peterson
http://mdavid.name | http://www.oreillynet.com/pub/au/2354 |
http://dev.aol.com/blog/3155
___
users mailing list
users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] .NET Dynamic Languages Group on Facebook

2007-07-23 Thread Michael Foord
Gary Williams wrote:
> The registration page isn't working (This page cannot be 
> displayed)...unless of course, I'm doing something wrong (a high 
> probability scenario :))
It worked ok for me a few minutes ago (and thanks David).

Michael Foord
http://www.voidspace.org.uk/ironpython/index.shtml

>  
> *Gary Williams*
>  
>
> 
> *From:* [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] *On Behalf Of *M. David 
> Peterson
> *Sent:* Monday, July 23, 2007 9:59 AM
> *To:* Discussion of IronPython; [EMAIL PROTECTED]
> *Subject:* [IronPython] .NET Dynamic Languages Group on Facebook
>
> http://www.oreillynet.com/windows/blog/2007/07/net_dynamic_languages_group_on.html
>  
>
>
> -- 
> /M:D
>
> M. David Peterson
> http://mdavid.name | http://www.oreillynet.com/pub/au/2354 | 
> http://dev.aol.com/blog/3155
> 
>
> ___
> users mailing list
> users@lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>   

___
users mailing list
users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] .NET Dynamic Languages Group on Facebook

2007-07-23 Thread Gary Williams
The registration page isn't working (This page cannot be
displayed)...unless of course, I'm doing something wrong (a high
probability scenario :))
 
Gary Williams
 



From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of M. David
Peterson
Sent: Monday, July 23, 2007 9:59 AM
To: Discussion of IronPython; [EMAIL PROTECTED]
Subject: [IronPython] .NET Dynamic Languages Group on Facebook


http://www.oreillynet.com/windows/blog/2007/07/net_dynamic_languages_gro
up_on.html 

-- 
/M:D

M. David Peterson 
http://mdavid.name | http://www.oreillynet.com/pub/au/2354 |
http://dev.aol.com/blog/3155 
___
users mailing list
users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] .NET Dynamic Languages Group on Facebook

2007-07-23 Thread M. David Peterson

http://www.oreillynet.com/windows/blog/2007/07/net_dynamic_languages_group_on.html
--
/M:D

M. David Peterson
http://mdavid.name | http://www.oreillynet.com/pub/au/2354 |
http://dev.aol.com/blog/3155
___
users mailing list
users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] Recent Check-Ins

2007-07-23 Thread Sanghyeon Seo
I suspect the "automation" mentioned last month isn't fixed after all.
http://lists.ironpython.com/pipermail/users-ironpython.com/2007-June/005099.html

John Lam posted IronRuby Pre Alpha 1 code on his site, and diffing its
Microsoft.Scripting directory against one from IronPython 2.0 Alpha 2
I get:

92 files changed, 2847 insertions(+), 1035 deletions(-)

Here is the command I used:

$ diff -I @microsoft.com -urN IronPython-2.0A2/Src/Microsoft.Scripting
IronRuby-Pre-Alpha1/Src/Microsoft.Scripting | diffstat

-I options is there to ignore mail address changes from
[EMAIL PROTECTED] to [EMAIL PROTECTED]

-- 
Seo Sanghyeon
___
users mailing list
users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] Contributions to IronPython library source

2007-07-23 Thread Mark Rees
Hi,

I see in John Lams announcement of the IronRuby first source code
release (http://www.iunknown.com/2007/07/a-first-look-at.html), they
will be accepting source code contributions into the IronRuby
libraries. So I cannot resist asking if the IronPython will have the
same policy soon for IronPython 2.0 libraries and hopefully IronPython
1.1.

Regards

Mark
___
users mailing list
users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com