Bernard wrote (portions snipped): > I disagree entirely on the "maximise portability". The maximum is ascii. You > can even read it without a computer. > ... > Sorry, but it seems archaic to me (in a situation such as we are talking > about) not to write the file in ascii.
First off, we're talking about a general purpose parser here, not a file conversion program. In all likelihood, most, if not all, of the programs it will be used with will probably link directly to it, and there will be no intermediate file or storage involved - just a data buffer of some sort returned from a function call. The output isn't intended for an end user - it's intended for a program. The whole idea and purpose of a parser is to put the data in a machine readable format that the rest of the program can actually make use of in a non-sequential fashion. Even with ABC, most of the possible applications out there needs to maintain some information for non-sequential access. A notation program needs to access the key, clef, and time signature as it starts each staff. A player program needs to access the tempo, and will need to loop through repeated notes. Format conversion programs may need to access everything in a completely different order. An editor program might need to randomly access any individual range of notes. And so on. Not to mention that all of them need to access numerical values as actual numbers, not strings. Converting ABC into yet another ASCII based format means that you need to create yet another parser for *that* text format to get it into something your program can actually *use* in a non-sequential format. (And what would the output of *that* parser be, eh?) You could possibly write that secondary parser to simulate random access - a call to get the key of Tune 15 as of the 23rd measure, for example. But that would be prohibitively expensive in terms of processing time as you reparse the ASCII stuff over and over again. (Yes, even with today's faster processors...) Not to mention the complexity of writing functions to return every conceivable bit of data. Honestly, it makes absolutely no sense to me whatsoever to be making an intermediate ASCII text format the output of a general purpose parser. It defeats the entire purpose of there *being* a parser in the first place. Mind you, I agree that C structures are somewhat archaic, but they do the job. Ideally the output should be a set of objects, but then you'd lose cross-language portability. -->Steve Bennett To subscribe/unsubscribe, point your browser to: http://www.tullochgorm.com/lists.html
