Cecil
Posted: Sat Jan 04, 2014 6:12 pm
I kicked off a new thread regarding the usage of Mono.Cecil in Cobra. This came up in another thread starting here:
viewtopic.php?f=4&t=17215&start=30#p22538
nerdzero mentioned doing this in the IDE add-in, but I would think doing it in the compiler would make more sense so that the compiler and IDE were always in sync doing the same thing.
Here is a tiny Cobra sample:
The more I think about it, the more convinced I am to go this route. System.Reflection has its problems and no one on the .NET team seems to be fixing them.
Plenty of projects have gone before us, so I think we'll be fine:
https://github.com/jbevain/cecil/wiki/Users
Any questions or concerns?
viewtopic.php?f=4&t=17215&start=30#p22538
nerdzero mentioned doing this in the IDE add-in, but I would think doing it in the compiler would make more sense so that the compiler and IDE were always in sync doing the same thing.
Here is a tiny Cobra sample:
"""
cecil.cobra
Download nuget.exe and then:
nuget install Mono.Cecil
copy Mono.Cecil<TAB>\...\Mono.Cecil.dll .
cobra cecil.cobra
@help AssemblyDefinition
@help Module
@help TypeDefinition
"""
use Mono.Cecil
class P
def main
name = 'Cobra.Core.dll'
ad = AssemblyDefinition.readAssembly(name)
trace ad, ad.name, ad.fullName
for mod in ad.modules
trace mod, mod.name
for type in mod.types
trace type, type.name
print 'done.'
The more I think about it, the more convinced I am to go this route. System.Reflection has its problems and no one on the .NET team seems to be fixing them.
Plenty of projects have gone before us, so I think we'll be fine:
https://github.com/jbevain/cecil/wiki/Users
Any questions or concerns?