Code Monkey home page Code Monkey logo

Comments (3)

BlobCodes avatar BlobCodes commented on June 9, 2024

Not all crystal properties can be mapped to GObject properties, therefore I would suggest using an annotation, raising an error if there is no equivalent gtype.

Also, there are modules using the getter, setter, property macros so I think we should put blurb, nick and additional arguments into the annotation.

Example:

@[GObject::Property(min: 10, max: 20, access: :read)]
@some_int : Int32

@[GObject::Property(default: -1, blurb: "this is unused")]
property something : UInt64

We still have to override the setter/getter/property macros to emit a notify signal on property change.

I'm already working on an implementation, there I just looped over the instance vars using {% for Ivar in @type.instance_vars %} and only generated a GObject property where the annotation is set.

from gi-crystal.

hugopl avatar hugopl commented on June 9, 2024

Not all crystal properties can be mapped to GObject properties, therefore I would suggest using an annotation, raising an error if there is no equivalent gtype.

It's true, better just use the annotation so, and if the annotation is going to be explicit used, better put the property options there.

And I think we don't need to care about constructor-only properties.

from gi-crystal.

hugopl avatar hugopl commented on June 9, 2024

Implemented on 6383125

from gi-crystal.

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.