Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make API less abstract and confusing #10

Open
sdroege opened this issue Mar 21, 2021 · 3 comments
Open

Make API less abstract and confusing #10

sdroege opened this issue Mar 21, 2021 · 3 comments
Assignees

Comments

@sdroege
Copy link
Owner

sdroege commented Mar 21, 2021

What I would suggest is the following

  • Foo becomes Animal
    • Implements Nameable
    • increment() vfunc becomes pet() and returns a Sound (former RString). E.g. cats would "purr"
    • incremented signal becomes made_sound(), see above. This can of course also happen independently of calling
    • name property stays and maps to the Nameable interface
    • 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 environment read-only property of type Environment (the flags type): "house", "garden", "aquarium", whatever
  • Bar becomes Cat
    • number property would become collar-color of type Color (the enum)
  • Nameable can stay the same, Animals and other things are usually nameable
  • RString becomes Sound (or a better name)
    • Also we'd add accessors for the non-NUL-terminated string plus length without copying
  • SharedRString becomes Name (and is used as part of Nameable). 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? :)

@sdroege sdroege changed the title Make API a less abstract and confusing Make API less abstract and confusing Mar 21, 2021
@zeenix
Copy link

zeenix commented Mar 21, 2021

* `number` property would become `collar-color` of type `Color` (the enum)

How about breed instead or in addition?

@elmarco
Copy link
Collaborator

elmarco commented Mar 21, 2021

@slomo looks good, and promising (more cleanup and improvements!)

@sdroege
Copy link
Owner Author

sdroege commented Mar 21, 2021

Then let's go for that.

@sdroege sdroege self-assigned this Mar 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants