Hi, I'm not even sure how to formulate the question, so I didn't find much help by searching the forum / online resources. Here's what I'm trying to do and maybe you could advise:
I'm writing a parser for AMF format (Flash object serialization). This format has record for what it's calling `array'. Yet this isn't an array in common understanding, it's rather a composition of an array part and a sort of a hash table, so, I'll call it further ecma-array. Now, the problem with ecma-array is that it may be as they call it `sparse', which means, that it may have indices 0 through 10 set, for example, and then indices 20 through 30 set, but 10 through 20 are empty. This looks on the wire as if the indices 20 through 30 were all string keys into hash table. When parsing such thing, I could probably find out those `sub-arrays', and even consolidate them or create separate sub-arrays etc.
My problem however is that I will need to create a special ecma-array class to perform like normal array, while it would fetch the data from different places when it's iterated over, or, when it's requested to tell what it's length is etc. I've looked at macroexpand of (loop ...) macro and it looks like it is implementation specific. I could however roll my own iterator for example. The thing I'm not sure is what is considered proper to do in this situation: should I try to make it usable with (loop ...) or is there any certain pattern one would write an iterator and that is believed to be easily understood by others? Lastly, if I want it to be usable in the loop, then what functionality exactly do I have to implement to make it work?
Thanks!
