[erlang-questions] Adoption of perl/javascript-style regexp syntax

Richard O'Keefe ok@REDACTED
Wed Jun 3 05:07:02 CEST 2009


On 3 Jun 2009, at 12:39 am, Masklinn wrote:
> An area where the raw string approach is superior to literal  
> patterns syntax (on top of Erlang not having pattern/re objects in  
> the first place) is that it also allows writing e.g. UNC paths  
> (which use backslashes as separators).

But UNC paths are yet another case of a structured data type.
According to one source I found, UNC paths actually started in
the UNIX world, and indeed, POSIX to this day says that a file
name starting with two forward slashes is special.  So something
like
\\Shared1_svr\Shared1\WGroups\Network\Orders.xls
really ought to be
    {unc,Server,Volume,Path,FileName}, e.g.,
    {unc,"Shared1_svr","Shared1",["WGroups","Network"],"Orders.xls"}
which can be slashified or backslashified at the point where it is
needed, *which need not be the machine it was read on*.  For what
it's worth, this should be a non-issue for UNC paths anyway, since
Windows has always accepted forward slashes as well as backslashes.
I've seen some really horrible code making UNC paths and taking them
apart that would have been ever so simple using {unc,_,_,_} trees.



More information about the erlang-questions mailing list