-
Notifications
You must be signed in to change notification settings - Fork 382
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
RFC: an object-oriented vmod_blob? #4255
Comments
To the question of object-oriented blobs I would wholeheartedly approve, but not so much in vmod_blob. At some point I was working with @walid-git on enriching the type system to make the built-in types more powerful and in some cases make vmods obsolete (or reduce their scope). The plan was roughly:
With your example, we could imagine something like this:
And you could do: set req.url = "/?url=" + req.url.encode(lower); The items with check marks in the plan were partially implemented but I don't remember where we stopped or what was left to do to drive the current type system from documentation like we do for variables. My 2 cents. |
@dridi thank you for this interesting perspective! Too bad that your initiative did not get further yet. I have two questions on your comment:
|
I'm sure we'll find time to revisit this with @walid-git. He wrote all the code so far so he probably remembers better than me where it's currently at.
In this case I suggested a
It can be simply backed by a resp.http.location.tourl().path
I'm pretty sure I have already said publicly that I was in favor, where a function taking a type as its first argument could turn into a method. I haven't given much thought to designing that and at first glance it looks like a tough nut to crack open. |
@dridi thank you. Regarding the Regarding the first argument idea, yes, you did mention that at some point and I forgot. |
Oh, @dridi, after my first impression of your idea being alternative to the suggestion herein, are they not actually complementary? sub vcl_init {
new percent = codec.string(URL, LOWER);
}
sub vcl_recv {
set req.url = "/?url=" + req.url.percent.encode();
} |
The problem is symbol collisions. If a |
Yes they could be, but I would rather invest first in richer built-in types. |
then name it differently? |
When we add new symbols to VCL there's always the risk of breaking third-party VMODs. For example when the variables I'm fine with that kind of breakage. If we make our type system richer, chances are that we may more easily add attributes or methods to types than we add new global symbols. That would create very subtle VCL breakage caught somewhat late during VCL compilation (unlike a failed import statement) because a new symbol could magically replace another with a new release. |
@dridi at least we have |
Asking for feedback: Should we have a different interface to the encode/decode functions provided by vmod_blob? Depending on feedback, I would turn this into a VIP or not.
Quick idea draft:
The text was updated successfully, but these errors were encountered: