[Nix-dev] builtins.toPath returns ... a string?

Ben Doyle benjamin.peter.doyle at gmail.com
Fri May 23 18:40:48 CEST 2014


So maybe the right thing to do is to remove toPath entirely? Personally, I
found the documentation and behavior highly confusing.

Alternatively, if toPath is still being used somewhere important (and if
changing it caused a regression, it probably is), we could update or remove
the documentation.


On Fri, May 23, 2014 at 1:15 AM, Wout Mertens <wout.mertens at gmail.com>wrote:

> ... But that was not right?
> https://github.com/nixos/nix/commit/17dc306aa32c48dcde6bfc12ad5e4b48f6b88974
>  On May 22, 2014 9:47 PM, "Shea Levy" <shea at shealevy.com> wrote:
>
>> Possibly relevant discussion: https://github.com/NixOS/nix/pull/47
>> On Thu, May 22, 2014 at 09:04:19PM +0400, Kirill Elagin wrote:
>> > The relevant commit is this:
>> >
>> https://github.com/NixOS/nix/commit/d7efd7639420f4c840cbfdfcbbb3c45292f3ac54
>> > Looks like `toPath` is not only obsolete, but prohibited since
>> semantics of
>> > paths changed and now it makes no sense no convert something to a path.
>> >
>> >
>> > --
>> > Кирилл Елагин
>> >
>> >
>> > On Thu, May 22, 2014 at 7:49 PM, Marc Weber <marco-oweber at gmx.de>
>> wrote:
>> >
>> > > --eval-only --strict -xml output:
>> > >
>> > > of
>> > >
>> > >   {
>> > >     s = "/home";
>> > >     p = /home;
>> > >     to_p = builtins.toPath "/home";
>> > >   }
>> > >
>> > > Same
>> > >
>> > >   || <?xml version='1.0' encoding='utf-8'?>
>> > >   || <expr>
>> > >   ||   <attrs>
>> > >   ||     <attr column="3" line="3" name="p" path="/tmp/test.nix">
>> > >   ||       <path value="/home" />
>> > >   ||     </attr>
>> > >   ||     <attr column="3" line="2" name="s" path="/tmp/test.nix">
>> > >   ||       <string value="/home" />
>> > >   ||     </attr>
>> > >   ||     <attr column="3" line="4" name="to_p" path="/tmp/test.nix">
>> > >   ||       <string value="/home" />
>> > >   ||     </attr>
>> > >   ||   </attrs>
>> > >   || </expr>
>> > >
>> > >
>> > > primops.cc
>> > >
>> > >   /* Convert the argument to a path.  !!! obsolete? */
>> > >   static void prim_toPath(EvalState & state, const Pos & pos, Value *
>> *
>> > > args, Value & v)
>> > >   {
>> > >       PathSet context;
>> > >       Path path = state.coerceToPath(pos, *args[0], context);
>> > >       mkString(v, canonPath(path), context);
>> > >   }
>> > >
>> > > You may want to talk about your use case.
>> > >
>> > > Marc Weber
>> > > _______________________________________________
>> > > nix-dev mailing list
>> > > nix-dev at lists.science.uu.nl
>> > > http://lists.science.uu.nl/mailman/listinfo/nix-dev
>> > >
>>
>> > _______________________________________________
>> > nix-dev mailing list
>> > nix-dev at lists.science.uu.nl
>> > http://lists.science.uu.nl/mailman/listinfo/nix-dev
>>
>> _______________________________________________
>> nix-dev mailing list
>> nix-dev at lists.science.uu.nl
>> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>>
>
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20140523/ad4ce648/attachment.html 


More information about the nix-dev mailing list