On 03 Sep 2014, at 15:44, Esteban A. Maringolo <emaring...@gmail.com> wrote:

> Esteban A. Maringolo
> 
> 
> 2014-09-02 17:46 GMT-03:00 Sven Van Caekenberghe <s...@stfx.eu>:
>> 
>> On 02 Sep 2014, at 21:39, Esteban A. Maringolo <emaring...@gmail.com> wrote:
>> 
>>> Thank you. It is certainly better than the base parser.
>>> But for formats I can't pass Date objects to #format:, I have to
>>> convert them to ZTimestamp before.
>> 
>> (ZTimestampFormat fromString: '2001/02/03') format: Date today.
>> 
>> Can you give an example of what does not work for you ?
> 
> My own brain doesn't work.
> I don't know what I did yesterday, but it works as expected now :)
> 
> | format |
> format := (ZTimestampFormat fromString: '03/02/2001') createDate.
> format parse: '03/09/2014'.
> format format: Date today

OK

> The only thing I'd change is to throw a specific Exception instead of
> an AssertionFailure.
> But I'm handling parsing errors fine with AssertionFailure handlers anyway.

Yes, using #assert: was laziness in the prototyping phase, I try to improve 
that part.

>>> Curiosity #1: Why did you use an example date string instead of using
>>> regular patterns like yyyy, dd, hh/hh24, etc?
>> 
>> That is why the formatter/parser was written in the first place ;-) It is 
>> modelled after a Go standard library 
>> (http://golang.org/src/pkg/time/format.go) and some Ruby library I can't 
>> remember the name of. I implemented this as a proof of concept to see if/how 
>> it could be done.
> 
> Fair enough. :)
> 
> 
> Thank you!


Reply via email to