|View Issue Details [ Jump to Notes ]||[ Issue History ] [ Print ]|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0000328||mercury||Bug||public||2014-05-01 17:19||2014-05-01 20:05|
|Target Version||Fixed in Version|
|Summary||0000328: dir.foldl2 should be called dir.fold2|
|Description||The foldl functions and predicates in the dir module do not guarantee any specific order. Therefore the l (indicating left) in their name is a misnomer. The should be deprecated in favor of names without the 'l'.|
|Tags||No tags attached.|
I disagree. An order is guaranteed, it's just not specified what it is since the actual order is OS (and probably in our case target language) dependent. However, there is an order there and foldl2 goes from first to last in that order. (It doesn't, example, go from last to first.)
Indeed the definition of the C function readdir (which we use to implement foldl2 on POSIX systems) says:
The type DIR, which is defined in the <dirent.h> header, represents a directory stream, which is an
ordered sequence of all the directory entries in a particular directory.
I'm not convinced. Given that the order is undefined, I really don't see the point in saying we start at it's beginning.
I choose to report this because I quickly looked at the docs, and then in my code i wrote "dir.fold2", because that's what makes sense. The compiler prompted me to change it. This suggests to me that "fold2" is the natural way to think about this.
|Undefined is not the same as system dependent, which is what this is. If you think the fold versions would be useful synonyms then feel free to add them, but I think deprecating the foldl versions is just change for the sake of change. (I suggest you also change the documentation to say that the order is OS dependent or words to that effect.)|
|2014-05-01 17:19||pbone||New Issue|
|2014-05-01 17:49||juliensf||Note Added: 0000675|
|2014-05-01 17:59||pbone||Note Added: 0000676|
|2014-05-01 20:05||juliensf||Note Added: 0000677|