[Newbies] Efficient date parsing

Randal L. Schwartz merlyn at stonehenge.com
Wed Apr 2 21:04:59 UTC 2008


>>>>> "Ramon" == Ramon Leon <ramon.leon at allresnet.com> writes:

Ramon> Or more idiomatic...

Ramon> ^dateCache at: dateString ifAbsentPut: [Date from: dateString].

Yeah, shortly after I posted that, I remembered that. :)

Also, for the beginners. you need to initialize dateCache to a Dictionary.
the normal way to do that is to have an instance side method called
#initialize:

        initialize
                super initialize. "NEVER NEVER leave this out"
                dateCache := Dictionary new.

When you save this, squeak will ask "I dunno dateCache", and you should
make it an instance variable.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


More information about the Beginners mailing list