Git Product home page Git Product logo

Comments (6)

jbevain avatar jbevain commented on June 1, 2024

I'm sorry but I'm completely unsure what you're asking here.

When calling Import, Cecil only imports metadata that doesn't belong to the current module. Now it does this when you actually call Import, but what would be the advantage of delaying it until the file is actually serialized ?

from cecil.

rvaquette avatar rvaquette commented on June 1, 2024

I have the case where a TypeDefinition is created in an assembly, and I create another assembly with an new TypeDefinition that has the first one as base class.
In fact I should need a trick to avoid importing the first TypeDefinition and to have Cecil makes it itself...!

from cecil.

jbevain avatar jbevain commented on June 1, 2024

I don't see what's the issue here.

In assembly Foo, you add type A.
In assembly Bar, you modify the base type of type B with the result of Import (A).

And that's about it.

from cecil.

rvaquette avatar rvaquette commented on June 1, 2024

In fact I wonder if Cecil could do the job for the developer (I mean to call the Import method)...

from cecil.

jbevain avatar jbevain commented on June 1, 2024

Cecil can not do that at write time, because it would break the principle that in an object graph, everything shares the same module. In that case, the BaseType would have a different module, which is wrong.

So that would mean that to be solved, we would have to modify every setter, such as BaseType to say:

this.base_type = (value.Module != this.Module) ? this.Module.Import (value) : value;

Which ends up being very weird. You set a property with a value and the property ends up with another value, which is unintuitive.

All in all, it's much simplier to let the user do the proper import, especially when it has to import open generic types, which require a context.

from cecil.

rvaquette avatar rvaquette commented on June 1, 2024

OK, you agree.

This issue can be closed.

from cecil.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.