Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expected relative path #243

Closed
ckeller opened this issue Oct 10, 2019 · 14 comments · Fixed by #289
Closed

expected relative path #243

ckeller opened this issue Oct 10, 2019 · 14 comments · Fixed by #289
Assignees

Comments

@ckeller
Copy link

ckeller commented Oct 10, 2019

Hi

I would like to call lambdapi on a file which is not in a subdirectory of my working directory, say /tmp/foo.dk. However, lambdapi fails with the following error:

$ lambdapi /tmp/foo.dk 
[unknown location] Invalid path for [/tmp/foo.dk] (expected relative path).

I am using the opam package but a quick look at the master branch let me think that it would produce the same answer.

Thank you for your help.

@fblanqui
Copy link
Member

Hello Chantal. This is on purpose. For the moment, LP does not accept file names with absolute paths. Why not running LP in /tmp, or moving your file foo.dk somewhere else?

@ckeller
Copy link
Author

ckeller commented Oct 10, 2019

I am calling lambdapi from another tool so

  • I do not control the working directory from which lambdapi is called
  • I do not want to pollute the user's space

Why such a restriction?

@fblanqui
Copy link
Member

Workaround: instead of calling LP directly, use a script that will run LP on the filename part only from the dirname part.
Why such a restriction? @rlepigre shall give you some argument soon hopefully.

@rlepigre
Copy link
Contributor

The justification for this behavior is that this enforces a correspondence between file path and module path. This simplifies many things, but there are also limitations as you just discovered @ckeller. Of course, this is not satisfactory, and we need some mechanism that:

  1. is more permissive,
  2. retains some of the good properties we have now for the dependency analysis.

There are several options here:

  1. Having a PATH-like mechanism (a list of directories to explore in order when looking for a module).
  2. Introducing mappings between arbitrary directories and module path prefixes (that is what Coq does to some extend I believe, but it is not always great).

Could you please elaborate a bit on your use case @ckeller:

  1. Are your Lambdapi files completely self-contained? If that is the case, then there is an easy workaround.
  2. Would a PATH-like mechanism suffice for your application?

@francoisthire
Copy link
Contributor

francoisthire commented Oct 11, 2019 via email

@ckeller
Copy link
Author

ckeller commented Oct 11, 2019

Hi @rlepigre
Thank you for the explanation.

1. Are your Lambdapi files completely self-contained? If that is the case, then there is an easy workaround.

No, the objective is to have a prelude in some directory and some other files in other directories. We can as a first step be ok with a self-contained file but not on the longer term. What would the workaround be?

2. Would a `PATH`-like mechanism suffice for your application?

Probably, see above for what we need.

@rlepigre
Copy link
Contributor

What are the issues with Coq system? I have the impression that it is always better to make the distinction between the file system and the logical path.

@francoisthire the problem is that the user is responsible for doing to many things (e.g., writing a _CoqProject file). I would like to have more automation on that front (i.e., a reasonable default behaviour). For instance, given an entry point for the installed libraries (that is a path like /.../lib/lambdapi) you could then access the files in inner folders like stdlib/list.lp using the qualification stdlib.list, and similarly for matita/blabla.dk. So installing everything in that particular folder would be enough for Lambdapi to be able to find any installed file in the expected way.

@rlepigre
Copy link
Contributor

rlepigre commented Oct 11, 2019

We can as a first step be ok with a self-contained file but not on the longer term. What would the workaround be?

@ckeller: I'll elaborate later, but I was thinking of running the command cd dir; lambdapi file.lp instead of lambdapi dir/file.lp.

(I'm busy right now, but I'll try to come up with a solution that we could then all discuss to see if it suits everyone's need.)

@fblanqui
Copy link
Member

This issue is a kind of duplicate of #93 . We should close one of the two.

@fblanqui
Copy link
Member

@ckeller did you find a workaround?

@fblanqui
Copy link
Member

@rlepigre we should really do something about that because this is the second time a user stumbles on this issue...

@ckeller
Copy link
Author

ckeller commented Oct 20, 2019

@fblanqui For the moment, my workaround is to use dkcheck (I know, it is not going to be developed anymore). I may switch to lambdapi in the next weeks using @rlepigre trick but I admit it would be very useful to be able to call lambdapi independently from the path.

Anyway, thank you for your help and for developping lambdapi!

@fblanqui
Copy link
Member

Hello @rlepigre . Do you think you can handle this issue soon?

@rlepigre
Copy link
Contributor

Yeah, I'm gonna try to do that before the end of the month.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants