Re: [Ironpython-users] Modifying ASTs when embedding IronPython

2012-03-01 Thread Vernon Cole
Err, ummm, ... Are you perhaps trying to reinvent Resolver 1 -- a spreadsheet written in Python? Maybe I misunderstand what you are trying to do, but you may want to look at it, unless you cannot use a commercial product. On Mar 1, 2012 7:58 PM, "Curt Hagenlocher" wrote: > I would argue that this

Re: [Ironpython-users] Modifying ASTs when embedding IronPython

2012-03-01 Thread Curt Hagenlocher
I would argue that this is a bad idea. How Python-compatible do you want this simple Excel-like language to be? If it's really just a small subset of the full Python language, you may be better off writing a simple parser that emits Python text as its back end and prevents the users from doing anyt

Re: [Ironpython-users] Modifying ASTs when embedding IronPython

2012-03-01 Thread Dino Viehland
Yep, but all of the main IronPython nodes will show up as an extension node so you'll want to override VisitExtension instead of VisitBinary. VisitBinary is for simple binary operations such as adding two primitive values and doesn't include dynamic binary operations. From: ironpython-users-bo

Re: [Ironpython-users] Modifying ASTs when embedding IronPython

2012-03-01 Thread Tuomas Utrecht
Ok, I'm going to read up on this, but to confirm, I'd need something like the following (from reading http://stackoverflow.com/questions/7944521/interrupt-interpreted-user-code-in-silverlight )? public class ExpressionRewriter : ExpressionVisitor { protected override Expression VisitBinary(Bin

Re: [Ironpython-users] Implicit conversion of objects to float

2012-03-01 Thread Dino Viehland
We also might recognize something like op_Power or Power if the method has [SpecialName] attribute, but I'm not 100% certain if that's still there. > -Original Message- > From: [email protected] > [mailto:ironpython-users-bounces+dinov=microsoft@

Re: [Ironpython-users] Modifying ASTs when embedding IronPython

2012-03-01 Thread Dino Viehland
The ASTs are generally immutable so to re-write you'll create a copy of the AST and any parent nodes. The ExpressionVisitor class makes this easy in that you can override VisitExtension method and re-write any Python nodes you care about there. You return a modified node somewhere within the t

Re: [Ironpython-users] Implicit conversion of objects to float

2012-03-01 Thread Cesar Mello
It worked perfectly and fast! Thank you so much Best regards Mello On Thu, Mar 1, 2012 at 5:37 PM, Jeff Hardy wrote: > On Thu, Mar 1, 2012 at 12:13 PM, Cesar Mello wrote: > > Hey guys! > > > > Just curious: is there a way to implement in the .NET class something > that > > maps to the ** o

Re: [Ironpython-users] Implicit conversion of objects to float

2012-03-01 Thread Jeff Hardy
On Thu, Mar 1, 2012 at 12:13 PM, Cesar Mello wrote: > Hey guys! > > Just curious: is there a way to implement in the .NET class something that > maps to the ** operator? You should be able to create a method called __pow__ like so: public object __pow__(object b, object e) { ... } Replace ob

[Ironpython-users] Modifying ASTs when embedding IronPython

2012-03-01 Thread Tuomas Utrecht
Hello, I apologize if this has been answered elsewhere, but I am unable to find anything up to date, or that covers my question in particular. The short version is: Can I modify the AST of a parsed file before compiling/executing in an embedded context? I want to allow simple, Excel-like statemen

Re: [Ironpython-users] Implicit conversion of objects to float

2012-03-01 Thread Cesar Mello
Hey guys! Just curious: is there a way to implement in the .NET class something that maps to the ** operator? I've tried the other way: calling into a Python function that works as a factory of proxy objects. These proxies overload the arithmetic operators and delegates everything to the real (.N

[Ironpython-users] IronPython, Daily Digest 2/29/2012

2012-03-01 Thread no_reply
Hi ironpython, Here's your Daily Digest of new issues for project "IronPython". In today's digest:ISSUES 1. [New issue] json.dump fails to dump Unicode strings 2. [New issue] Traceback is lost when ImportError is re-raised 3. [New comment] Traceback is lost when ImportError is re-raised 4. [New