[Swift-devel] simple_mapper separators

Ben Clifford benc at hawaga.org.uk
Tue Jul 24 09:42:36 CDT 2007


I've been poking through simple_mapper to look at the various bugs open on 
that code.

There's some special case handling for path component separators (in the 
abstractfilemapper superclass) such that the last component separator ends 
up being a "." instead of whatever comes from the supplied 
FileNameElementMapper (which is "_" in the default case).

See the test in svn 

 tests/language-behaviour/T077-simplemapper-bug80.swift, 

which is also here:

http://www.ci.uchicago.edu/trac/swift/browser/trunk/tests/language-behaviour/T076-simplemapper-bug80.swift?format=raw

This maps a three level array structure to filenames in a fairly 
straightforward fashion.

The output files are:

T077-simplemapper-bug80.aleph.out
T077-simplemapper-bug80.beth.out
T077-simplemapper-bug80_subordinate.epsilon.out
T077-simplemapper-bug80_subordinate.sigma.out
T077-simplemapper-bug80_subordinate_moresubordinate.hamza.out

Its a bit surprising/unintuitive that the last separator that comes from 
the expression path is a "." rather than a "_" like the other ones, at 
least in the presence of a suffix; though I can see circumstances where it 
is useful (when the structure fields have the same name as filename 
extensions and there is not suffix).

The path of least complexity says that this final separator change 
shouldn't happen - its easier to document and easier to explain.

-- 



More information about the Swift-devel mailing list