Now that we have the constructor issues resolved, I was looking back over the constructor documentation. I noticed the old default constructor tried looking up a method named "fromStr" before using "make". I was wondering, does this still have a purpose? The doc mentions simple serialization, but other than that passing reference, it doesn't give any reason why you would ever use fromStr over make.
brianWed 15 Apr 2009
It still serves a good purpose to write code like this:
d := Date("2009-0415")
tacticsWed 15 Apr 2009
So, fromStr is more for when you want to have a more programmatic constructor (for instance, Date passing year, month, date) and fromStr is a humanized constructor? Or something like that?
tompalmerWed 15 Apr 2009
Seems related to prior discussions of overloading operators here for different types such that different-named methods can get called from the same operator. So, I guess we effectively have that feature for the constructor "operator". Also slice vs. get is similar, right?
tactics Wed 15 Apr 2009
Now that we have the constructor issues resolved, I was looking back over the constructor documentation. I noticed the old default constructor tried looking up a method named "fromStr" before using "make". I was wondering, does this still have a purpose? The doc mentions simple serialization, but other than that passing reference, it doesn't give any reason why you would ever use fromStr over make.
brian Wed 15 Apr 2009
It still serves a good purpose to write code like this:
tactics Wed 15 Apr 2009
So, fromStr is more for when you want to have a more programmatic constructor (for instance, Date passing year, month, date) and fromStr is a humanized constructor? Or something like that?
tompalmer Wed 15 Apr 2009
Seems related to prior discussions of overloading operators here for different types such that different-named methods can get called from the same operator. So, I guess we effectively have that feature for the constructor "operator". Also slice vs. get is similar, right?