Prev: Vo 2.7 Garbage Collector
Next: CRC32
From: Ginny Caughey on 13 Nov 2006 08:19 rob, As I see it, the macro support in Vulcan is there to support VO legacy code, so the issues you mention don't come up. Probably you would use CodeDom for new Vulcan code where you needed the features you're describing. (Or use macros for new Vulcan code if that provides all you need since it's a lot less code.) -- Ginny "rob" <rob_panosh(a)asdsoftware.com> wrote in message news:1163423698.667127.156160(a)i42g2000cwa.googlegroups.com... > Markus, > > Are you kidding me? That is exactly what we moved away from, CodeDOM > is the way to go. How would you execute the sample code below using > macros? Also, with macros what if you wanted to add a reference to > another assembly (at runtime) and execute some of it's code? I > SERIOUSLY doubt that would be possible. > > Sample Code: > ------------------- > Dim myCollection AS System.Collections.Generics.List( Of System.Int32 ) > > > For Each item As System.Int32 IN myCollection > If Item > 10 > Me.DoSomething() > EndIf > Next > > Cheers, > Rob > > Markus Feser wrote: >> "rob" <rob_panosh(a)asdsoftware.com> schrieb im Newsbeitrag >> news:1163176292.970140.220880(a)k70g2000cwa.googlegroups.com... >> >> Rob, >> >> in Vulcan >> >> s := "System.Environment.CurrentDirectory" >> ? &s >> >> Regards, >> Markus Feser >> >> >> > Markus, >> > >> > I have a complete scripting object (which I cannot send because it's >> > embedded in our application) wrapper around the compiler services. But >> > I can show you an example on how we compile into a .DLL in our >> > application. We also have instances where we compile in secondary >> > application domain so references to Assemblies can be released. Also, >> > if you are looking for a good editor in your application (with >> > intellisense) to use to write your source code then take a look at >> > http://www.qwhale.net, it supports C#.Net, VB.Net, XML, HTML, and many >> > other languages. >> > >> > Sample Code: >> > 'Defined in the class dec. >> > Private Shared _provider As New Microsoft.VisualBasic.VBCodeProvider >> > Private _compileParameters As New >> > System.CodeDom.Compiler.CompilerParameters >> > Private _compileResults As System.CodeDom.Compiler.CompilerResults >> > >> > 'Now configure the compile environment. Note: References are added in >> > me.New() >> > If production Then >> > 'REP: 08.28.2006 - To be compatible with pv 4.5 calc strings we >> > need script off. >> > Me._compileParameters.CompilerOptions = "/optionstrict-" ' & >> > rootNameSpace >> > Else >> > Me._compileParameters.CompilerOptions = "/optionstrict+" ' & >> > rootNameSpace >> > End If >> > >> > Me._compileParameters.GenerateInMemory = True >> > Me._compileParameters.GenerateExecutable = False >> > Me._compileParameters.WarningLevel = 4 >> > Me._compileParameters.IncludeDebugInformation = False >> > Me._compileParameters.TreatWarningsAsErrors = True >> > Me._compileParameters.TempFiles.KeepFiles = False >> > >> > If Not Me._compileResults Is Nothing Then >> > Me._compileResults.Output.Clear() >> > End If >> > >> > 'Compile the source code. >> > Me._compileResults = >> > _provider.CompileAssemblyFromSource(Me._compileParameters, >> > Me.ProductionSourceCode) >> > >> > 'This is the assembly we invoke our members (Properties and Methods). >> > Me._productionAssembly = Me._compileResults.CompiledAssembly >> > >> > ... >> > >> > Cheers, >> > Rob Panosh >> > >> > Markus Feser wrote: >> > > > Yes ... Visual Basic.Net, C#.Net ... It's NOT magic. All you need >> > > > to >> > > > do is use the .NET compiler services. >> > > > >> > > > Rob >> > > >> > > Hello Rob, >> > > >> > > can you show us a sample? >> > > >> > > Regards, >> > > Markus Feser >> > >
From: rob on 13 Nov 2006 08:21 Ginney, >> Yes you can do the whole CodeDom thing in Vulcan too just as you suggest. Have you worked with CodeDom in Vulcan or C#? > As far as I know that's more or less how macros are implemented in Vulcan > anyway. But with Vulcan you also have the option of just easily using macros > like in VO. I seriously doubt that. Are you aware everytime you compile code in memory using CodeDom it creates an assembly in memory and the only way to unload this assembly would be to compile into seperate application domain? If Vulcan is compiling this code every time it is run then you are going to have a serious memory leak. Rob Ginny Caughey wrote: > Heiko, > > Yes you can do the whole CodeDom thing in Vulcan too just as you suggest. As > far as I know that's more or less how macros are implemented in Vulcan > anyway. But with Vulcan you also have the option of just easily using macros > like in VO. > > -- > Ginny > > > "hei_mue" <h.mueller(a)wincontent.de> wrote in message > news:1163410811.581495.65600(a)i42g2000cwa.googlegroups.com... > > Hi Markus, > > > > Markus Feser schrieb: > >> in Vulcan > >> s := "System.Environment.CurrentDirectory" > >> ? &s > > > > This isn't very impressive. Encapsulate the Compiler-Calling in a > > simple static method (? is nothing other) is easy. But the allways > > available Compilers in .NET can do much more for you... > > > > Here is a simple Method that creates a Class from Sourcecode that is > > consigned as string (think about storing classes in a Database for > > really DataDrivern-Applications): > > > > At First 'How To call this in your own Source'... > > > > object > > oMyObject=ClassHelper.CreateFromSource(sMySource,"TestClass",this,new > > ArrayList()) > > > > And this is the Code (only a smale example - for 'real world use' you > > shouldt have to add a better errror-handling (try catch finally): > > > > public static object CreateFromSource(string sSource, string > > sClassName, object oOwner, ArrayList aAssemblies) > > { > > CodeDomProvider oCompiler = new CSharpCodeProvider(); > > CompilerParameters oParameters = new CompilerParameters(); > > CompilerResults oResult; > > Assembly oAssembly; > > object oReturn = null; > > > > aAssemblies.Add("System.dll"); > > aAssemblies.Add("System.Data.dll"); > > aAssemblies.Add("System.Xml.dll"); > > foreach (string sAssembly in aAssemblies) > > { > > oParameters.ReferencedAssemblies.Add(sAssembly); > > } > > oParameters.GenerateInMemory = true; > > > > oResult = oCompiler.CompileAssemblyFromSource(oParameters, sSource); > > > > if (oResult.Errors.HasErrors) > > { > > string sMessage = ""; > > sMessage = oResult.Errors.Count.ToString() + " Fehler : "; > > for (int x = 0; x < oResult.Errors.Count; x++) > > { > > sMessage += "\r\nLine : " + oResult.Errors[x].Line.ToString() > > + " - " + oResult.Errors[x].ErrorText; > > } > > MessageBox.Show("Fehler beim erzeugen der Klasse.\r\n"+sMessage); > > } > > > > oAssembly = oResult.CompiledAssembly; > > > > oReturn = oAssembly.CreateInstance(sClassName, false, > > BindingFlags.CreateInstance, null, new object[] { oOwner }, > > System.Globalization.CultureInfo.CurrentCulture, null); > > if (oReturn == null) > > { > > MessageBox.Show("Objekt der Klasse "+sClassName+" konnte nicht > > erzeugt werden."); > > return oReturn; > > } > > > > return oReturn; > > } > > > > As you can see: The CodeDom-Provider in .NET is much more then a simple > > ? in VO... > > > > Heiko Mueller > > > > PS: Of course you can do all this things in Vulcan (I hope this for > > you). Its not Vulcan or C# or whatever - its .NET... > >
From: Ginny Caughey on 13 Nov 2006 09:36 rob, >>> Yes you can do the whole CodeDom thing in Vulcan too just as you >>> suggest. > Have you worked with CodeDom in Vulcan or C#? No, I'm not really a macro sort of person. But Vulcan is just .NET and can make use of all the .NET classes, and Vulcan includes a CodeDom provider. >> As far as I know that's more or less how macros are implemented in Vulcan >> anyway. But with Vulcan you also have the option of just easily using >> macros >> like in VO. > I seriously doubt that. Are you aware everytime you compile code in > memory using CodeDom it creates an assembly in memory and the only way > to unload this assembly would be to compile into seperate application > domain? If Vulcan is compiling this code every time it is run then you > are going to have a serious memory leak. I don't know the technical details, but I do understand that macros in Vulcan use a subset of the Vulcan compiler. Strictly speaking, I don't think what you're describing would be a memory leak though, although it might be wasteful. I bet the Vulcan runtime is smarter than that since performance seems to be the #2 goal after compatibility with VO, which is #1. Ginny > > Rob > > Ginny Caughey wrote: >> Heiko, >> >> Yes you can do the whole CodeDom thing in Vulcan too just as you suggest. >> As >> far as I know that's more or less how macros are implemented in Vulcan >> anyway. But with Vulcan you also have the option of just easily using >> macros >> like in VO. >> >> -- >> Ginny >> >> >> "hei_mue" <h.mueller(a)wincontent.de> wrote in message >> news:1163410811.581495.65600(a)i42g2000cwa.googlegroups.com... >> > Hi Markus, >> > >> > Markus Feser schrieb: >> >> in Vulcan >> >> s := "System.Environment.CurrentDirectory" >> >> ? &s >> > >> > This isn't very impressive. Encapsulate the Compiler-Calling in a >> > simple static method (? is nothing other) is easy. But the allways >> > available Compilers in .NET can do much more for you... >> > >> > Here is a simple Method that creates a Class from Sourcecode that is >> > consigned as string (think about storing classes in a Database for >> > really DataDrivern-Applications): >> > >> > At First 'How To call this in your own Source'... >> > >> > object >> > oMyObject=ClassHelper.CreateFromSource(sMySource,"TestClass",this,new >> > ArrayList()) >> > >> > And this is the Code (only a smale example - for 'real world use' you >> > shouldt have to add a better errror-handling (try catch finally): >> > >> > public static object CreateFromSource(string sSource, string >> > sClassName, object oOwner, ArrayList aAssemblies) >> > { >> > CodeDomProvider oCompiler = new CSharpCodeProvider(); >> > CompilerParameters oParameters = new CompilerParameters(); >> > CompilerResults oResult; >> > Assembly oAssembly; >> > object oReturn = null; >> > >> > aAssemblies.Add("System.dll"); >> > aAssemblies.Add("System.Data.dll"); >> > aAssemblies.Add("System.Xml.dll"); >> > foreach (string sAssembly in aAssemblies) >> > { >> > oParameters.ReferencedAssemblies.Add(sAssembly); >> > } >> > oParameters.GenerateInMemory = true; >> > >> > oResult = oCompiler.CompileAssemblyFromSource(oParameters, sSource); >> > >> > if (oResult.Errors.HasErrors) >> > { >> > string sMessage = ""; >> > sMessage = oResult.Errors.Count.ToString() + " Fehler : "; >> > for (int x = 0; x < oResult.Errors.Count; x++) >> > { >> > sMessage += "\r\nLine : " + oResult.Errors[x].Line.ToString() >> > + " - " + oResult.Errors[x].ErrorText; >> > } >> > MessageBox.Show("Fehler beim erzeugen der Klasse.\r\n"+sMessage); >> > } >> > >> > oAssembly = oResult.CompiledAssembly; >> > >> > oReturn = oAssembly.CreateInstance(sClassName, false, >> > BindingFlags.CreateInstance, null, new object[] { oOwner }, >> > System.Globalization.CultureInfo.CurrentCulture, null); >> > if (oReturn == null) >> > { >> > MessageBox.Show("Objekt der Klasse "+sClassName+" konnte nicht >> > erzeugt werden."); >> > return oReturn; >> > } >> > >> > return oReturn; >> > } >> > >> > As you can see: The CodeDom-Provider in .NET is much more then a simple >> > ? in VO... >> > >> > Heiko Mueller >> > >> > PS: Of course you can do all this things in Vulcan (I hope this for >> > you). Its not Vulcan or C# or whatever - its .NET... >> > >
From: Markus Feser on 13 Nov 2006 11:53 > Are you kidding me? That is exactly what we moved away from, CodeDOM > is the way to go. How would you execute the sample code below using > macros? Also, with macros what if you wanted to add a reference to > another assembly (at runtime) and execute some of it's code? I > SERIOUSLY doubt that would be possible. > > Sample Code: > ------------------- > Dim myCollection AS System.Collections.Generics.List( Of System.Int32 ) > > > For Each item As System.Int32 IN myCollection > If Item > 10 > Me.DoSomething() > EndIf > Next uaaahhhh, I like C# very much, but Visual Basic is nothing FOR ME like Ginny said, Macros in Vulcan are additional possible. CodeDOM can also be used so everybody can use what he want that's DotNet <g> Regards, Markus Feser
From: Geoff on 13 Nov 2006 16:15
Heiko, > Be I the only one who can see this fact? No, you are not the only one - I got kicked out of the VOPS for raising such concerns over and over. And I raised these concerns over and over because I was being ignored and my concerns being written off as fanatasy. Well now the cat is out of the bag. The Vulcan converter, which they warmly call their warp speed transporter, cannot convert standard VO GUI classes out of the box. So who the hell are they aiming this at? What I have been saying all along is now substantiated truth. Converting most VO apps to Vulcan will not be possible without substantial re-writes. Geoff |