Comments (3)
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.
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.
Implemented on 6383125
from gi-crystal.
Related Issues (20)
- Boolean return type for vfuncs are not converted
- Enforce type safety on vfunc return types.
- WebKit2 library define a None enum != 0 and fail to compile
- Enum and flags can't be ignored in binding.yml
- Virtual functions does not obey return value ownership transfer HOT 1
- Virtual functions that return nullable objects fail to compile
- Support GC resistant GObject subclasses HOT 2
- Boolean false constants are bindinded with true value
- Error compiling harf_buzz - can't use variable name 'extents' inside assignment to variable 'extents' HOT 3
- nullable transfer full params doesn't check for null before increase object reference.
- transfer full interface parameters don't get their reference increased.
- Fail to compile with newer libraries. HOT 1
- g_unichar must be Crystal Char, not UInt32
- Interface casts crashes
- [Request] non-void signals HOT 2
- Parameters with filename tag must be declared as Path | String
- ::Bytes should be used on array of unsigned chars parameters
- User signals with nilable parameters doesn't work. HOT 1
- syntax error in './gsk-4.0/path_point.cr:122:13': can't use variable name 'center' inside assignment to variable 'center' HOT 3
- Latest glib API changes HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gi-crystal.