Hi Slava, > Slava Pestov wrote: > > I'd suggest using a config object too. There is precedent in a few > existing libraries, like io.launcher's run-process word, the UI's > open-window word, and others. >
So something like: : file>csv ( path/descriptor -- csv ) : csv ( stream/descriptor -- csv ) : csv-row ( descriptor -- csv ) : csv>file ( rows path/descriptor encoding -- ) : write-row ( row descriptor -- ) : write-csv ( rows stream/descriptor -- ) Also the config descriptor object would need to have both a path and a stream slot which feels a little cludgy. I guess we're working around the lack of optional args in a stack language. The advantage of config combinator (e.g. with-dialect) is that it can be used across all the apis, but I agree it's not the neatest solution. (actually it probably is the neatest for the csv-row and write-row calls which would be called repeatedly potentially further down the callstack. A dynamic var combinator saves passing config descriptors around). Maybe the csv parser should be an object itself? "myfile" <csvparser> CHAR: \t >>delimiter parsefile Duh! - Actually that's functionally the same as having each word take a separate config descriptor! Shall I stick with the combinator or do you still prefer the descriptors? Cheers, Phil ------------------------------------------------------------------------------ Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT is a gathering of tech-side developers & brand creativity professionals. Meet the minds behind Google Creative Lab, Visual Complexity, Processing, & iPhoneDevCamp as they present alongside digital heavyweights like Barbarian Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com _______________________________________________ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk