2019-04-21 04:11 AEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000328mercuryBugpublic2014-05-01 20:05
Reporterpbone 
Assigned To 
PrioritylowSeveritytweakReproducibilityalways
StatusnewResolutionopen 
PlatformAllOSAllOS VersionAll
Product Version 
Target VersionFixed in Version 
Summary0000328: dir.foldl2 should be called dir.fold2
DescriptionThe 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'.
TagsNo tags attached.
Attached Files

-Relationships
+Relationships

-Notes

~0000675

juliensf (administrator)

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.
      ^^^^^^

~0000676

pbone (administrator)

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.

~0000677

juliensf (administrator)

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.)
+Notes

-Issue History
Date Modified Username Field Change
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
+Issue History