On 04 Nov 2012, at 04:10, Ben Coman <btc@openInWorld.com> wrote:
Continuing on... (The kids came in and I sent the last post off before I finished :)
5. Just dreaming... but since 80% of my time using NeoCSV was reviewing the data, transferring field headings to camelCase for the class definition, typing in each #addField: method. and since a lot of csv files have headings on the first line, something like a class NeoCSVGenerator that read the headings to create a class with matching instance variables would be really nice. In the first instance it could just output a string for the user to be manually copy/execute to the right location. Maybe later push it through the refactoring browser. For example.... ---- csvgen := NeoCSVGenerator createclass: MotorData on: csvStream csvgen classDefinition inspect. csvgen methodDefinition inspect. ----
#methodDefinition could read in the whole sample file and add comments for each field line showing the Integer/Float/blank statistics for to assist with decision making. ---- addField: #horsePower: ; "100 floats, 3 integers, 2 blanks" ----
In the new year (after I have handed in my thesis), you might bump me to add this myself (if you are interested but hadn't done it already).
That might indeed be an option. It goes a bit further than what I want to add to NeoCSV and it might be hard to make it portable, but if one needs to parse many different CSV files with many fields, it could save a lot of work. Another, less efficient iidea would be to create dictionaries for each record with the field names as keys. -- Sven Van Caekenberghe http://stfx.eu Smalltalk is the Red Pill