Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
hjk10156962ypackage main
import "time"
const birthdayBoy = "b2plane"
type Age time.Time
func (a Age) Add(d time.Duration) Age {
return time.Time(a).Add(d)
}
type Store interface {
GetAge(username string) (Age, error)
SetAge(username string, age Age) error
}
// Fixme handle errors
func main () {
store := NewStore()
b2old, _ := store. GetAge(birthdayBoy)
b2old = b2old.Add(1 * time.Year)
store.SetAge(birthdayBoy, b2old)
} -
hjk10156962yBefore I get a lot of crap. This was just having some fun and wonder if people recognize the language. It has the quality of a recruitment cringe "code" message. Anyone sane would not mix age and date/time in the same unit (just store the birthday and calculate age is the way) but python pseudocode above got me inspired. Also it doesn't compile. There is no Year constant for example 🤣🤣🤣.
Hope you had a happy cake day @b2plane!
It's my birthday
🦁🙏🎂🍰🎉🎈
rant