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

[WIP] High level api #2

Merged
merged 15 commits into from
Aug 20, 2019
Merged

Conversation

HugoGranstrom
Copy link
Contributor

Hi, I found this project and it seemed like a good first project for interfacing with C (all the hard work has already been done by you 😉). Before I went any further with this I wanted to hear from you if my approach is reasonable or if it has any big flaws. This is my first time working with pointers so I may have gotten something wrong. I wrote a few tests that can be run with nimble test and they seem to work.

My thought is that we call the ptr mpd_t DecimalType instead for readablitity and we can initialize from ints and strings with newDecimal().

What do you think? 😄

Copy link
Contributor

@mratsim mratsim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice start, here are a couple of pointers to improve the wrapping

decimal/decimal.nim Show resolved Hide resolved
decimal/decimal.nim Outdated Show resolved Hide resolved
decimal/decimal.nim Outdated Show resolved Hide resolved
decimal/decimal.nim Outdated Show resolved Hide resolved
@HugoGranstrom
Copy link
Contributor Author

Now almost all functions from the "Arithmetic Functions" are wrapped (left out a few odd ones). I also tried to make it nimble installable by renaming and moving some things. On my machine, it works at least. Travis and Appveyor seem to disagree (are they on an older version perhaps?). I did also add templates for adding DecimalType with SomeNumber, I'm a bit split on that matter though as it kind of encourages not using arbitrary precision :/ Was thinking it would make statements like let a = x ^ 2 more intuitive by templating it to: let a = x ^ newDecimal($2). Any opinions on this?

This should definitely be ready for a test ride now. I have lots of more tests to write, and documenting all procs with a ## doc but I want an opinion before I procedes with that.

@mratsim
Copy link
Contributor

mratsim commented Jul 18, 2019

Whoops, this passed under my radar, flooded with Github updates.

You shouldn't move to the src/ directory structure in the same PR as it makes review very hard. And while I prefer the src structure, it triggers several annoying issues with nim imports and nimble:

Don't hesitate to ping me on IRC/Gitter if I forget again.

Copy link
Contributor

@mratsim mratsim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The last commit can be reverted. I can take care of the directory structure. The other commits are good.

@HugoGranstrom
Copy link
Contributor Author

Hehe 😅 I got a bit too ambitious here. Should have realized it made a big mess of it all 🤣

Thank for handling it :-) Your feed must be bombarded with updates all the time, amazed that you can handle it 😄

I'll keep on working on this then 😉

@HugoGranstrom
Copy link
Contributor Author

I think that's it 😅 Documentation comments are added to all non-obvious procs and next to everything should be covered in the tests.
If I have missed some very obvious procs: shout! 🤣🙏

Copy link
Contributor

@mratsim mratsim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, it's just missing the auto deletion but I'll add it myself

@mratsim mratsim merged commit 4e6d76b into status-im:master Aug 20, 2019
@HugoGranstrom
Copy link
Contributor Author

Awesome 😄

You know those stuff better than I do 👍😉

@mratsim mratsim mentioned this pull request Aug 28, 2019
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

Successfully merging this pull request may close these issues.

3 participants