gobject-example-rs
gobject-example-rs copied to clipboard
Make API less abstract and confusing
What I would suggest is the following
-
FoobecomesAnimal- Implements
Nameable -
increment()vfunc becomespet()and returns aSound(formerRString). E.g. cats would "purr" -
incrementedsignal becomesmade_sound(), see above. This can of course also happen independently of calling -
nameproperty stays and maps to theNameableinterface - Add a new
lift()vfunc that either succeeds or returns the (to be written)GError: "too heavy", "too slippery" (e.g. a fish), "hissed", etc - Add a new
environmentread-only property of typeEnvironment(the flags type): "house", "garden", "aquarium", whatever
- Implements
-
BarbecomesCat-
numberproperty would becomecollar-colorof typeColor(the enum)
-
-
Nameablecan stay the same,Animals and other things are usually nameable -
RStringbecomesSound(or a better name)- Also we'd add accessors for the non-NUL-terminated string plus length without copying
-
SharedRStringbecomesName(and is used as part ofNameable). Names are usually used often and immutable- Also we'd add accessors for the non-NUL-terminated string plus length without copying
CC @elmarco what do you think? Any suggestions for improvements or changes? :)
* `number` property would become `collar-color` of type `Color` (the enum)
How about breed instead or in addition?
@slomo looks good, and promising (more cleanup and improvements!)
Then let's go for that.