Open gmcfarlane opened 2 years ago
Hey there. Upon studying the new codebase, I realize that you have made a lot of progress. Very much appreciated. I have put my data in the parserScript object. This gets passed along w/ each script and is precisely what was needed to solve my issue. It also addresses the concern i had about 2 scripts fighting w/ each other over the global variables in your previous version!
awesome work sir.
greg
Hi Greg,
The new version now has support for multiple interpreters, take a look. No more global shared variables.
Cheers, Vassili
how do you handle circular references?
i have cobbled something together... wondering if you have a more elegant solution that you use.
greg
-----Original Message----- From: "Vassili Kaplan" @.> Sent: Saturday, August 20, 2022 5:05pm To: "vassilych/cscs" @.> Cc: "gmcfarlane" @.>, "Author" @.> Subject: Re: [vassilych/cscs] Operating on host project data (Issue #30)
Hi Greg, The new version now has support for multiple interpreters, take a look. No more global shared variables. Cheers, Vassili — Reply to this email directly, view it on GitHub , or unsubscribe . You are receiving this because you authored the thread.Message ID: @.***>
hi, what do you mean? Can you provide a CSCS code for that example?
Thanks Vassili
On Mon, Aug 22, 2022 at 1:49 PM gmcfarlane @.***> wrote:
how do you handle circular references? i have cobbled something together... wondering if you have a more elegant solution that you use.
greg
-----Original Message----- From: "Vassili Kaplan" @.> Sent: Saturday, August 20, 2022 5:05pm To: "vassilych/cscs" @.> Cc: "gmcfarlane" @.>, "Author" @.> Subject: Re: [vassilych/cscs] Operating on host project data (Issue #30)
Hi Greg, The new version now has support for multiple interpreters, take a look. No more global shared variables. Cheers, Vassili — Reply to this email directly, view it on GitHub , or unsubscribe . You are receiving this because you authored the thread.Message ID: @.***>
— Reply to this email directly, view it on GitHub https://github.com/vassilych/cscs/issues/30#issuecomment-1222245707, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE74VFBUAKT7D2KMUHRQWTLV2NSONANCNFSM5TZNXVCQ . You are receiving this because you commented.Message ID: @.***>
/*i am wondering if we should not have every fresh call chain be a tree. what would I do w that
the goal here is not to delay my project which i hope makes me a lot of money, but it is to prevent circular references, lets do that and then stop... for now...
*/ using System; using System.Collections.Generic; using System.Text; using dataAccess;
namespace Peregrine { public class dependencyTree { private static dependencyTree _instance;
dependencyTreeItem _root = null;
private dependencyTree(dependencyTreeItem root_)
{
_root = root_;
_tree = new Dictionary<string, dependencyTreeItem>();
_tree.Add(root_.nameHash, root_);
}
public static void InitializeTree(dependencyTreeItem root_)
{
_instance = new dependencyTree(root_);
}
private static dependencyTree Instance
{
get
{
if (null == _instance) throw new Exception("tree has not been initialized");
return _instance;
}
}
public static dependencyTreeItem Root
{
get { return Instance._root; }
}
public Dictionary<string, dependencyTreeItem> _tree;
public static Dictionary<string, dependencyTreeItem> Tree
{
get { return Instance._tree; }
}
public static void Resolve()
{
Instance._root.Resolve();
foreach (dependencyTreeItem child in Instance._root.ChildItems)
{
//just cause you are my child does not mean you depend on me.
// quite contraire... you probably need to look at my properties...
// so i can not depend on you.... execpt when i do...
child.Resolve();
}
}
public static void AddTreeNode(dependencyTreeItem anItem_, dependencyTreeItem dependsOnThisItem_)
{
if (false == Instance._tree.ContainsKey(dependsOnThisItem_.nameHash))
{
Instance._tree.Add(dependsOnThisItem_.nameHash, dependsOnThisItem_);
}
dependencyTreeItem ti = Instance._tree[dependsOnThisItem_.nameHash];
if (dependencyTreeItem.RESOLVED_INPROGRESS == ti.resolved)
{
string offendingStack = string.Concat(anItem_.CurrentCallChain, dependencyTreeItem.CC_COUPLER, dependsOnThisItem_.nameHash);
throw new Exception("You crazy goose. You have made a circular reference. " + offendingStack);
}
}
public static Reset()
{
instance = null;
}
public static bool IsTreeInitialized()
{
return (null != _instance);
}
}
}
Not sure what does it have to do with CSCS? You provided C# code, not CSCS...
functions defined within cscs can call each other... functionA could call functionB which calls functionA....
Its, ok. I think we have answered the question that there is not a cyclical reference detection facility w/in CSCS.
If i get mine to something that would survive the real world, Ill let you know.
Thank you very much for sharing this project. I was going to try and address my requirements w/ a spreadsheet package! would have been a nightmare!
greg
-----Original Message----- From: "Vassili Kaplan" @.> Sent: Monday, August 22, 2022 11:53am To: "vassilych/cscs" @.> Cc: "gmcfarlane" @.>, "Author" @.> Subject: Re: [vassilych/cscs] Operating on host project data (Issue #30)
Not sure what does it have to do with CSCS? You provided C# code, not CSCS... — Reply to this email directly, view it on GitHub , or unsubscribe . You are receiving this because you authored the thread.Message ID: @.***>
Hello sir
thank you for the cool work. I have been looking for this, originally found the mdsn articles...
I have a project that deals with financial data. I have projects, cashflows, etc. I want to be able to let the user do some basic scripting and say 'this instance should be the sum of those things...' etc.
i originally pulled the code off msdn. After thinking about a lot of approaches... embedding delegates, i decided the most straight forward way was to make the parser not be a singleton. Instead, i make a parser instance, and pass data into that, then all the functions have access to the parser.
i considered passing data into the singleton, but figured it was a matter of time before two scripts walked on each other. the data would essentially be a global.
I ran into an issue w/ the msdn code and found this github.
I am going to do some testing and make sure i dont have the same basic problem here. Assuming that checks out, how would you suggest integrating host project data? I see there is one other issue that essentially asking for the same thing.