[Mono-osx] NObjective and Inheritance

Eugeny Grishul eugeny.grishul at gmail.com
Wed Feb 18 20:48:11 EST 2009

Hi Martin!

>Do you have a mode that will not use the proxy-weaver based inheritance? 
I'm debating adding one.  >I realize it will make the generated proxies
pretty large, but I'm wondering how much larger it would >make the compiled
binaries.  If  I had to guess, I'd think maybe 2x or 3x larger, which might
be a >small price to pay to not have to rely on (as rodrigo mention) a Mono
CLR bug.

Without method duplication (with weaver) in proxy assemblies them takes
about 7MB on hard disk. After duplication assemplies takes about 60MB of
compiled code for each platform ( 120MB for Tiger+Leopard and will 180MB
with 10.6 =) ). It's anyway unaaceptable and is not small price. Anyway
there is another project - Monobjc where each objective-c class corresponds
to .NET class. But Laurent's approach not efficient enough - monobjc
internally used Dictinary for matching native and managed objects. Mine
approach eliminates need in such dictinary and overheads on object creation.

>I was taking a look at the code and it doesnt look like HeaderAnalyzer is
used anymore.  It's looking >like you extract all the method and property
information from the Objective-C runtime itself.  Is that >true? the
HeaderAnalyzer.Analyze(..) method is commented out in ProfileBuilder.  Also
this means that >NObjectiveAST seems like it's not being used.

HeaderAnalyzer+NObjectiveAST used to generate "parsed_headers.xml" (see
code). And since this file was generated I don't want spend time while
regenerating it. When Snow Leopard comes to market I'll uncomment that line
and generate "parsed_headers.xml" for Mac OS 10.6.

>Encoding a OO type hierarchy using valuetypes is plain wrong.
What about C++? Each class and struct is a value type but with inheritance
ability (and some others). Are programmers that designing their apps in C++
wrong?. Value types is most efficient way to combine memory management
schemes of Objective-C and Mono (see perftest on NObjective's main page).
Some of users told me that they don't want to attach to the Objective-C
object using managed counterpart, but want work with it as raw pointer. Only
value types can provide such ability.

>It's not a bug in mono, the CLR is designed this way and there is no
compeling reason to implement such broken behavior.
Mono bug is crashes while accessing of virtual methods of boxed object that
not derived from ValueType/Enum. CLR ( CLR = MS CLI implementation ) able to
run such code and I have no idea why Mono JIT team can't emulate such
behaviour. Also CLR runtime verifier accepts such code coz it's VALID CIL
(but not verifiable). 

Mono internally used a thousands of different hacks so using of vtypes not
directly inherited from ValueType/Enum isn't criminal. 

Eugeny Grishul
View this message in context: http://www.nabble.com/NObjective-and-Inheritance-tp21882576p22092432.html
Sent from the Mono - OSX mailing list archive at Nabble.com.

More information about the Mono-osx mailing list