Giter VIP home page Giter VIP logo

Comments (12)

rentzsch avatar rentzsch commented on June 28, 2024

I'm down with that, implementing it the way your described. I'd accept such a patch if you want to work it up. :-)

from mogenerator.

seanm avatar seanm commented on June 28, 2024

Cool. I could try, but won't have time for a few weeks. I wanted to at least get the ball rolling with this bug entry.

So how about key 'attributeValueSetterSemantics' where the value can be 'retain' or 'copy', and if there's no value it defaults to retain?

from mogenerator.

rentzsch avatar rentzsch commented on June 28, 2024

I know about the busy thing :-) attributeValueSetterSemantics sounds fine.

from mogenerator.

rentzsch avatar rentzsch commented on June 28, 2024

Sounds like #84 supersedes this issue? Should I close it?

from mogenerator.

seanm avatar seanm commented on June 28, 2024

I don't think they're the same, but certainly related.

Regardless of memory model, there is a difference between copying and referencing an object.

It could still be useful, IMHO, it be able to tag an attribute as either 'copy' or 'retain aka strong'.

from mogenerator.

diederich avatar diederich commented on June 28, 2024

Here's a first shot: https://github.com/diederich/mogenerator/tree/propertiesWithCopy
Instead of allowing to define retain/copy in the userInfo dictionary, this approach uses a boolean value. I'm not sure if this is a good approach, but it works for the above example, as "strong" implies copy. Though others like weak, __unsafe_unretained might be interesting for the PONSO templates.

My current use case for this is an NSManagedObject which should implement a protocol that defines a property with copy semantics.

from mogenerator.

seanm avatar seanm commented on June 28, 2024

What do the two states of your boolean represent? What do you mean "strong implies copy"?

from mogenerator.

diederich avatar diederich commented on June 28, 2024

The state says either to use copy semantics or not.
If it's set to yes, the property is declared as

@property (nonatomic, copy) <Type> <Name>;

if set to no it's dependent on ARC. If ARC is enabled it's

@property (nonatomic, strong) <Type> <Name>;

without ARC it's

@property (nonatomic, retain) <Type> <Name>;

So there's no special case for ARC and copy. If you declare a property as with copy semantics, strong is implicitly added (http://clang.llvm.org/docs/AutomaticReferenceCounting.html#ownership.spelling.property)

from mogenerator.

honus avatar honus commented on June 28, 2024

I think you meant to say "copy implies strong" not "strong implies copy".

from mogenerator.

diederich avatar diederich commented on June 28, 2024

Definitely, thanks.

from mogenerator.

rentzsch avatar rentzsch commented on June 28, 2024

related: #84

from mogenerator.

justin avatar justin commented on June 28, 2024

This is ancient. Closing it out. If its still an issue for you, please open a new issue.

from mogenerator.

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.