Symbolic link as a source
#68
Closed
opened 9 years ago by kirelagin
·
5 comments
Loading…
Reference in New Issue
There is no content yet.
Delete Branch '%!s(<nil>)'
Deleting a branch is permanent. It CANNOT be undone. Continue?
Looks like it dereferences the link and uses
test.pm
to derive the template name and, obviously, fails, as there is no second-level extension.For the purpose of deriving the template name the original source name, as was input by user, should be used.
Your proposal amounts to a kind of imperative-programming-via-symlink, which is terrifying in its implications ;)
More practically, in this case the expected behavior is obvious, but only because the symlink and its target are in the same directory. What if the symlink were on another file system? What if it were a chain of symlinks with different file extensions along the way? In essence, Pollen would end up with a separate & more subtle implementation of symlinking than the filesystem itself.
Wait. What I’m trying to say is that Pollen itself should not care at all whether the file is a symlink or not. When I type
raco pollen render test.html.pm
I want it to taketest.html.pm
and turn it intotest.html
, that’s all. The fact thattest.html.pm
is a symlink is not Pollen’s business.I agree that this is bad. But as I said I can’t imagine why would Pollen bother with symlinking at all. I give it the name, it renders it, poof! 🎆
OK, I think I understand what you mean: Pollen shouldn’t do any symlink dereferencing. Rather, it should treat the symlink as a real source file and trust that things like
template.html
anddirectory-require.rkt
are nearby. And that way you can create secondary Pollen project directories that reuse the source from elsewhere (by symlinking). Is that right?Exactly.
Well, I wasn’t thinking about “elsewhere,” I just tried this as a work-around for #49 and it didn’t work, so I had to resort to hard-links. I can’t think of a use case for reusing text sources from other projects, but reusing code sources is a pretty common thing.
But the actual problem right now is that Pollen’s current behaviour is just very unnatural.
I see what you’re saying, but if we’re talking specifically about code reuse, I don’t want to support techniques (e.g., creative symlinking) that invite developers to circumvent the facilities already present in Racket for doing that. A Pollen file is just an alternate way of writing a Racket source file. Thus, every Pollen source file can be a target of a Racket
require
ordynamic-require
command. Or, going the other way, libraries of Racket functions can be made into locally-installed packages that can be accessed from any Pollen source file (just like the rest of the Racket library).But beyond that, I’m open to improving how Pollen handles symlinks (I barely use symlinks so I haven’t scrutinized the issue).