Closed matryer closed 11 years ago
The Sets are unnecessary because of interface{}. The Gets would be helpful, though.
On Jan 21, 2013, at 9:22 AM, matryer notifications@github.com wrote:
Add some common type getters and setters in Resource.
Examples include:
• GetTime(key) • SetTime(key, time) • GetNumber(key) • SetNumber(key, float64) • GetBool(key) • SetBool(key, bool) • GetString(key) • SetString(key, string) — Reply to this email directly or view it on GitHub.
I think the sets are worth including, they ensure type safety in code.
Imagine this:
resource.Set("ishappy", 50)
resource.GetBool("ishappy")
... of course, that's their fault. But SetBool("ishappy", 50)
wouldn't even compile.
That's a programmer error and it will panic when it tries to do a type conversion.
Your example could just as easily be:
resource.SetInt("ishappy",50) resource.GetBool("ishappy")
On Jan 21, 2013, at 9:25 AM, matryer notifications@github.com wrote:
I think the sets are worth including, they ensure type safety in code.
Imagine this:
resource.Set("ishappy", 50) resource.GetBool("ishappy")
— Reply to this email directly or view it on GitHub.
OK well let's do the getters first and we can always add setters later if there's apatite
Sounds good
On Jan 21, 2013, at 9:29 AM, matryer notifications@github.com wrote:
OK well let's do the getters first and we can always add setters later if there's apatite
— Reply to this email directly or view it on GitHub.
Add some common type getters and setters in Resource.
Examples include: