Hi Lee,
I've come across the same problem with C++/CLI and System::Func. IIRC
the compiler error is a known bug and it will not be fixed - at least
for VS 2008.
I worked around the missing/buggy System::Func^ by using Delegate^:
Delegate^ obj;
if (scope-TryGetVariableDelegate^(MyFunc, obj))
Hi Jeff,
I know that the return type of a dynamic expression cannot be determined
in general. But what would be a pragmatic way to guess the return type
of an expression?
Can you give some examples of expressions you need to infer?
arithmetic operations: a + b / c
functions: sqrt(a)
logical
Hi Vernon,
Maybe I'm missing the point -- are you trying to load data into an
existing data table, or to DEFINE a new data table?
Sorry for not clarifying this. I'm able to export to _new_ tables, which
will be created at runtime.
For existing tables we could easily work out with the
Hello,
we are using IronPython embedded into our application to evaluate user
defined expression. The variables used in the expressions are strongly
typed and the results need to be written back into a database.
I know that the return type of a dynamic expression cannot be determined
in
Hi all,
thanks for your discussion.
Actually I'm having an in-memory table of strongly typed columns. The
user can provide per-row (python-)expressions as additional columns. Now
if the user wants his result to be exported to a database (e.g. SQL
Server or Oracle) I need to set a type for
Hi,
we're using IronPython 2.6 within our C#-application to evaluate user
defined expressions.
Where can I find end user examples and documentation I can link to for
python expressions?
I looked at http://docs.python.org/reference/expressions.html but this
is too programmer oriented.
Hi Bruce,
thanks for your answer.
How much python will you let your users execute?
Potentially everything that can be put into
ScriptEngine.CreateScriptSourceFromString(
Expression, _SourceCodeKind.Expression_).Execute(ScriptScope)
Are they just typing in formulas or are they
Hi,
the following code snippet allocates constantly more and more memory.
Moving .Compile() outside the loop works as expected.
private static void LeakTest()
{
var runtime = Python.CreateRuntime();
var engine = runtime.GetEngine(py);
var sum = 0.0;
while (true)
{
var code =
Dear community,
please could anyone provide an example of how to create a parser in
IronPython 2.0 Beta 4. The examples I found are outdated (based on IP
2.0a3) and my own try ended in NullReferenceException (see my post on
2008-09-08).
Thanks
Christian
Hi,
I found some answers to my own questions. But I'm stuck again...
how can I determine the Symbols or SymbolIds that are used in an
(IP2-)expression?
Obviously I need to parse the expression. Where can I find a small
sample or tutorial on parsing in IP2?
Hi sesh,
thanks for your answer.
What would be the approach to extend a ScriptScope by the properties of
an object? Or in other words: How can I evaluate an expression in an
object's scope?
Any valid IronPython script snippet can be executed in the context of a scope.
Since an expression is
@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
--
--
Dr. Christian Schmidt
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
Hi,
I've derived from CustomSymbolDictionary to add specific variables to a
scope (see seshadripv's blog). What I would expect from a method called
TryGetExtraValue is that only if the scope (where the
IAttributesCollection was added in the constructor) cannot find the
SymbolId, the
Hi,
how can I determine the Symbols or SymbolIds that are used in an
(IP2-)expression?
Obviously I need to parse the expression. Where can I find a small
sample or tutorial on parsing in IP2?
Thanks,
Christian
___
Users mailing list
Hi Seshadri,
thanks for your answer.
The TryGetExtraValue and TrySetExtraValue methods can return a false
for SymbolIDs that they don't maintain. Those values will be looked
up in the actual scope.
I see, makes sense.
When accessing the baseScope from your example, isn't
Hi Curt,
thanks for your answer. It's an interesting idea, to hand over the items
as function arguments. I was trying to add them to the ScriptScope.
But I'm still stuck with calling the function:
ScriptScope scope =
ScriptRuntime.Create().GetEngine(py).CreateScope();
scope.Execute(from
brought up by Fernando Correia - Func IIRC is
only defined in .net 3.5, right?
Thanks,
Christian
On Tue, Aug 19, 2008 at 12:09 PM, Christian Schmidt
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote:
Hi Curt,
thanks for your answer. It's an interesting idea, to hand over the
items
Hi Dody,
If you are not using this in a .Net 3.5 website project, you can use
alias to deal with this Beta 4 issue.
I'm not using IP2 in a website project, but would like to use it in a
3.5 project. How do I have to set this alias?
Thanks,
Christian
Hi Dody,
thanks for your help.
delegate object FunctionProcess(object[] params);
I've already tried this one and also
delegate object FunctionProcess(params object[] p);
scope.GetVariableFunctionProcess (Process)
But get an ArgumentException (Invalid type of return expression value
at
Hi Dody,
thanks for your patience.
delegate System.Int32 FunctionProcess(System.Int32[] parameters)
This assumes that your Python implement will only do integer operation.
If you are going to use the delegate for generic holder of arguments,
don't forget to cast
for example:
delegate
Hi Dino,
Is there a reason ObjectOperations.Call(scope.GetVariable(Process),
args) doesn't work?
It seems that ObjectOperations does not have a static method Call. Where
do I get an ObjectOperations instance from?
I found another solution:
Delegate process =
Hi,
I'm trying to figure out the best way to embed IP 2 expressions into C#
to implement the following:
I have given a scope that consists of an IListobject and a mapping of
the list's indices to a name.
Now I want to evaluate several expressions within this scope.
After this, the scope
Hello community,
How can I replace the 3 parameter Evaluate-function from PythonEngine
engine.Evaluate(expression, module, locals)
where expression is a string, module is a EngineModule and locals is a
IDictionarystring, object by something like
delegate object
Hi all,
I'm using IronPython 1.1 as an expression evaluator in an C#
application. These expressions are evaluated repeatedly with different
variables. Therefore I should use CreateLambda instead of Evaluate. I
have the variables in an IDictionarystring, object. But I don't know
what the
Hi,
I'm trying to fill a treeview with the statements found in a embedded
python script. How do I traverse through the tree of parsed statements?
using IronPython;
using IronPython.Compiler;
using IronPython.Compiler.Ast;
void doparse(string txt) {
SystemState ss = new
Hi,
I want to implement special methods of classes in C# that I use from
ironpython.
For example C#'s equivalent of Python's __iter__ is to derive from
IEnumerable, __getitem__ corresponds to this[object], __init__ and
__del__ to constructor and destructor, __str__ to toString(), __hash__
to
26 matches
Mail list logo