relative imports and duplicate includes

Kacper Wysocki kacperw at gmail.com
Thu Nov 19 14:54:34 CET 2015


On Tue, Nov 17, 2015 at 10:39 PM, Poul-Henning Kamp <phk at phk.freebsd.dk> wrote:
> --------
> In message <CABaBnj6zzj6pf6KoUS=h7nBu5zF1e2pif+vg7BQmtOXLPPBwwQ at mail.gmail.com>
> , Kacper Wysocki writes:
>>> Maybe what we really need is VCL libraries:
[snip]
>>>         library geoip geoip.vcl [from "path"];
[snip]
>>Maybe? From a programmer perspective this is certainly cleaner.
>>However,  the people who run Varnish out there are primarily concerned
>>with ops problems. Will the library/namespaces approach resonate with
>>the ops folks?
>
> My experience is that the simpler cleaner solution is always preferable,
> in particular for the ops people.

I'm not clear on how this would work in practice;
I if I try to rewrite my example to use this approach;
 site1/main.vcl
 site1/foo.vcl
 site1/bar/baz.vcl

ok I'll declare in my default.vcl near the top

    library site1 main.vcl from "site1/main.vcl";

how does main.vcl refer to foo, bar and baz?
are these includes, or some new keyword?
Does the "from" statement make a path prefix to resolve includes?

> I don't think the mechanisms we use to implement typed arguments
> to VMOD entry points would very hard to adapt also to VCL functions:
>
>         def STRING
>         foobar(INTEGER a1, BACKEND a2, STRING_LIST a3) {
>                 ...
>         }
>
>         ...
>
>         sub vcl_recv {
>                 set req.http.magic =
>                     foobar(remote.ip.port, default_backend, req.http.cookie);
>         }

having function return values, that's cool, but how does it relate to this?

> If that is true, it *also* means, that you can do the "reverse":
>
> Take a bunch of VCL code, and compile it into a VMOD.
>
> That automatically gives us different namespaces for the VCL
> inside the VMOD and the main VCL.
>
> I need to look at how it works if the VMOD compiled from VCL
> imports a VMOD, but as I remember it, I think it would just Do
> The Right Thing.

Regarding imports, the problem is that I want to ship a vcl which
imports a vmod that you're already using. I most certainly do not want
to compile my vcl before shipping it. You've lost me here.

-Kacper



More information about the varnish-dev mailing list