|
View:
New views
6 Messages
—
Rating Filter:
Alert me
|
|
|
how can i load method body logic from a xxx.boo and control the method input parametersi have a C# method as follows: public void Parser(object taskId, IObjectFactory applicationContext,IDictionary resultMap) { // do something with input params } because this method body's content will change frequently so I want to the method body's content load from a xxx.boo,so it dosn't need to recompile the app when the method logic changed. i'm a newbe in boo,is this possible? and if this idea is possible how can i transfers method parameters into boo enviroment,so in xxx.boo file can control with method params --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Boo Programming Language" group. To post to this group, send email to boolang@... To unsubscribe from this group, send email to boolang-unsubscribe@... For more options, visit this group at http://groups.google.com/group/boolang -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: how can i load method body logic from a xxx.boo and control the method input parametersI don't understand what you're going for? Is there one file called something.boo that you want to load the method from and you will be changing this file on disk relatively often or do you want to load the methods body from a different boo file every time? In either case, you're going to need to have your Parser method create a BooCompiler and load the boo file then run it. Yes, you can put the method parameters into the boo environment with a compiler step. You'd have to put them in a convention based globals. Rhino DSL would make using the Boo compiler easier for you.. I have a blog post showing a trivial example of using Rhino DSL at http://nathan.whiteboard-it.com. On Sun, Jun 29, 2008 at 3:50 AM, Eric <FREDERICK.Mao@...> wrote: > > i have a C# method as follows: > public void Parser(object taskId, IObjectFactory > applicationContext,IDictionary resultMap) > { > // do something with input params > } > because this method body's content will change frequently so I want to > the method body's content load from a xxx.boo,so it dosn't need to > recompile the app when the method logic changed. > i'm a newbe in boo,is this possible? and if this idea is possible how > can i transfers method parameters into boo enviroment,so in xxx.boo > file can control with method params > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Boo Programming Language" group. To post to this group, send email to boolang@... To unsubscribe from this group, send email to boolang-unsubscribe@... For more options, visit this group at http://groups.google.com/group/boolang -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: how can i load method body logic from a xxx.boo and control the method input parametersSomething like that would help class dynamic: """ class for dynamic execution code and files """ booc = BooCompiler() context as CompilerContext assembly as Assembly ducky as bool: get: return booc.Parameters.Ducky set: booc.Parameters.Ducky = value errors as string: get: return context.Errors.ToString(true) def type(str as string): """calc type""" return assembly.GetType(str, true, true) def duck_obj(str as string): """create object 'str' type""" d as duck = type(str)() return d def compile(code as string): """ compile in memory """ booc.Parameters.Input.Add(StringInput("Input", code)) context = booc.Run() assembly = context.GeneratedAssembly return assembly def compile2memory(code as string): """ make dll in memory """ booc.Parameters.Pipeline = Pipelines.CompileToMemory() return compile(code) def compile2file(code as string, fname as string): """ make dll file fname """ booc.Parameters.Pipeline = Pipelines.CompileToFile() if fname.EndsWith('.dll'): booc.Parameters.OutputType = CompilerOutputType.Library else: booc.Parameters.OutputType = CompilerOutputType.ConsoleApplication booc.Parameters.OutputAssembly = fname return compile(code) def load(name as string): """ python like load comand """ sname = name + '.boo' sinfo = FileInfo(sname) dname = name + '.dll' dinfo = FileInfo(dname) assembly = null if sinfo.Exists: if not dinfo.Exists or sinfo.LastWriteTime > dinfo.LastWriteTime: compile2file(StreamReader(sname).ReadToEnd(), dname) else: assembly = Assembly.LoadFrom(dname) elif dinfo.Exists: assembly = Assembly.LoadFrom(dname) return assembly On 29 июн, 16:48, "Nathan Stott" <nrst...@...> wrote: > I don't understand what you're going for? Is there one file called > something.boo that you want to load the method from and you will be > changing this file on disk relatively often or do you want to load the > methods body from a different boo file every time? > > In either case, you're going to need to have your Parser method create > a BooCompiler and load the boo file then run it. > > Yes, you can put the method parameters into the boo environment with a > compiler step. You'd have to put them in a convention based globals. > > Rhino DSL would make using the Boo compiler easier for you.. I have a > blog post showing a trivial example of using Rhino DSL athttp://nathan.whiteboard-it.com. > > On Sun, Jun 29, 2008 at 3:50 AM, Eric <FREDERICK....@...> wrote: > > > i have a C# method as follows: > > public void Parser(object taskId, IObjectFactory > > applicationContext,IDictionary resultMap) > > { > > // do something with input params > > } > > because this method body's content will change frequently so I want to > > the method body's content load from a xxx.boo,so it dosn't need to > > recompile the app when the method logic changed. > > i'm a newbe in boo,is this possible? and if this idea is possible how > > can i transfers method parameters into boo enviroment,so in xxx.boo > > file can control with method params You received this message because you are subscribed to the Google Groups "Boo Programming Language" group. To post to this group, send email to boolang@... To unsubscribe from this group, send email to boolang-unsubscribe@... For more options, visit this group at http://groups.google.com/group/boolang -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: how can i load method body logic from a xxx.boo and control the method input parametersThat looks similar to DslFactory from Rhino DSL, George.
I agree that something like that would help the initial poster a great deal. 2008/6/29 George <g.dernovoy@...>: > > Something like that would help > > class dynamic: > """ > class for dynamic execution code and files > """ > booc = BooCompiler() > > context as CompilerContext > > assembly as Assembly > > ducky as bool: > get: > return booc.Parameters.Ducky > set: > booc.Parameters.Ducky = value > > errors as string: > get: > return context.Errors.ToString(true) > > def type(str as string): > """calc type""" > return assembly.GetType(str, true, true) > > def duck_obj(str as string): > """create object 'str' type""" > d as duck = type(str)() > > return d > > def compile(code as string): > """ > compile in memory > """ > booc.Parameters.Input.Add(StringInput("Input", code)) > > context = booc.Run() > > assembly = context.GeneratedAssembly > > return assembly > > def compile2memory(code as string): > """ > make dll in memory > """ > booc.Parameters.Pipeline = Pipelines.CompileToMemory() > > return compile(code) > > def compile2file(code as string, fname as string): > """ > make dll file fname > """ > booc.Parameters.Pipeline = Pipelines.CompileToFile() > > if fname.EndsWith('.dll'): > booc.Parameters.OutputType = CompilerOutputType.Library > else: > booc.Parameters.OutputType = CompilerOutputType.ConsoleApplication > > booc.Parameters.OutputAssembly = fname > > return compile(code) > > def load(name as string): > """ > python like load comand > """ > sname = name + '.boo' > > sinfo = FileInfo(sname) > > dname = name + '.dll' > > dinfo = FileInfo(dname) > > assembly = null > > if sinfo.Exists: > > if not dinfo.Exists or sinfo.LastWriteTime > dinfo.LastWriteTime: > > compile2file(StreamReader(sname).ReadToEnd(), dname) > else: > assembly = Assembly.LoadFrom(dname) > > elif dinfo.Exists: > > assembly = Assembly.LoadFrom(dname) > > return assembly > > On 29 июн, 16:48, "Nathan Stott" <nrst...@...> wrote: >> I don't understand what you're going for? Is there one file called >> something.boo that you want to load the method from and you will be >> changing this file on disk relatively often or do you want to load the >> methods body from a different boo file every time? >> >> In either case, you're going to need to have your Parser method create >> a BooCompiler and load the boo file then run it. >> >> Yes, you can put the method parameters into the boo environment with a >> compiler step. You'd have to put them in a convention based globals. >> >> Rhino DSL would make using the Boo compiler easier for you.. I have a >> blog post showing a trivial example of using Rhino DSL athttp://nathan.whiteboard-it.com. >> >> On Sun, Jun 29, 2008 at 3:50 AM, Eric <FREDERICK....@...> wrote: >> >> > i have a C# method as follows: >> > public void Parser(object taskId, IObjectFactory >> > applicationContext,IDictionary resultMap) >> > { >> > // do something with input params >> > } >> > because this method body's content will change frequently so I want to >> > the method body's content load from a xxx.boo,so it dosn't need to >> > recompile the app when the method logic changed. >> > i'm a newbe in boo,is this possible? and if this idea is possible how >> > can i transfers method parameters into boo enviroment,so in xxx.boo >> > file can control with method params > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Boo Programming Language" group. To post to this group, send email to boolang@... To unsubscribe from this group, send email to boolang-unsubscribe@... For more options, visit this group at http://groups.google.com/group/boolang -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: how can i load method body logic from a xxx.boo and control the method input parametersthank you for you demostration solve my problem,and I found you ide's color setting show at this article http://nathan.whiteboard-it.com is very cool,could you share the xxx.vssettings config file,thanks angain On 6月29日, 上午6时48分, "Nathan Stott" <nrst...@...> wrote: > I don't understand what you're going for? Is there one file called > something.boo that you want to load the method from and you will be > changing this file on disk relatively often or do you want to load the > methods body from a different boo file every time? > > In either case, you're going to need to have your Parser method create > a BooCompiler and load the boo file then run it. > > Yes, you can put the method parameters into the boo environment with a > compiler step. You'd have to put them in a convention based globals. > > Rhino DSL would make using the Boo compiler easier for you.. I have a > blog post showing a trivial example of using Rhino DSL athttp://nathan.whiteboard-it.com. > > > > On Sun, Jun 29, 2008 at 3:50 AM, Eric <FREDERICK....@...> wrote: > > > i have a C# method as follows: > > public void Parser(object taskId, IObjectFactory > > applicationContext,IDictionary resultMap) > > { > > // do something with input params > > } > > because this method body's content will change frequently so I want to > > the method body's content load from a xxx.boo,so it dosn't need to > > recompile the app when the method logic changed. > > i'm a newbe in boo,is this possible? and if this idea is possible how > > can i transfers method parameters into boo enviroment,so in xxx.boo > > file can control with method params- 隐藏被引用文字 - > > - 显示引用的文字 - You received this message because you are subscribed to the Google Groups "Boo Programming Language" group. To post to this group, send email to boolang@... To unsubscribe from this group, send email to boolang-unsubscribe@... For more options, visit this group at http://groups.google.com/group/boolang -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: how can i load method body logic from a xxx.boo and control the method input parametersGlad the blog was helpful.
Emailing you the vssettings file now. 2008/6/30 Eric <FREDERICK.Mao@...>: > > thank you for you demostration solve my problem,and I found you ide's > color setting show at this article http://nathan.whiteboard-it.com is > very cool,could you share the xxx.vssettings config file,thanks angain > On 6月29日, 上午6时48分, "Nathan Stott" <nrst...@...> wrote: >> I don't understand what you're going for? Is there one file called >> something.boo that you want to load the method from and you will be >> changing this file on disk relatively often or do you want to load the >> methods body from a different boo file every time? >> >> In either case, you're going to need to have your Parser method create >> a BooCompiler and load the boo file then run it. >> >> Yes, you can put the method parameters into the boo environment with a >> compiler step. You'd have to put them in a convention based globals. >> >> Rhino DSL would make using the Boo compiler easier for you.. I have a >> blog post showing a trivial example of using Rhino DSL athttp://nathan.whiteboard-it.com. >> >> >> >> On Sun, Jun 29, 2008 at 3:50 AM, Eric <FREDERICK....@...> wrote: >> >> > i have a C# method as follows: >> > public void Parser(object taskId, IObjectFactory >> > applicationContext,IDictionary resultMap) >> > { >> > // do something with input params >> > } >> > because this method body's content will change frequently so I want to >> > the method body's content load from a xxx.boo,so it dosn't need to >> > recompile the app when the method logic changed. >> > i'm a newbe in boo,is this possible? and if this idea is possible how >> > can i transfers method parameters into boo enviroment,so in xxx.boo >> > file can control with method params- 隐藏被引用文字 - >> >> - 显示引用的文字 - > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Boo Programming Language" group. To post to this group, send email to boolang@... To unsubscribe from this group, send email to boolang-unsubscribe@... For more options, visit this group at http://groups.google.com/group/boolang -~----------~----~----~----~------~----~------~--~--- |
| Free Forum Powered by Nabble | Forum Help |