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

Any reason for Amount being a data-structure? #73

Open
christianschmizz opened this issue Nov 17, 2020 · 1 comment
Open

Any reason for Amount being a data-structure? #73

christianschmizz opened this issue Nov 17, 2020 · 1 comment

Comments

@christianschmizz
Copy link

Would s/o please explain to me why Amount is a struct and not just a type alias which I expected to be more simple and sufficient?

// Amount is a datastructure that stores the amount being used for calculations.
type Amount struct {
	val int64
}

It seems more odd when I saw when the Amount is fetched we are getting the value.

func (m *Money) Amount() int64 {
	return m.amount.val
}
@Rhymond
Copy link
Owner

Rhymond commented Apr 15, 2021

good point, you're right it would be more sufficient to use type alias instead

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

2 participants