Company
Date Published
Author
Katherine Flavel
Word count
1631
Language
English
Hacker News points
None

Summary

Fastly has enhanced its Varnish Configuration Language (VCL) by introducing return values and parameters for user-defined subroutines, aligning it more closely with general-purpose programming languages. This update facilitates better code reuse and abstraction, addressing previous limitations where values had to be passed and returned through headers. The new syntax allows for a wider range of data types, including numeric types, ACLs, and backends, providing more flexibility in passing and returning values. Examples illustrate the new capabilities, such as concatenating strings, conducting A/B testing, selecting ACLs based on authentication, anonymizing IP addresses, and generating regional indicator symbols for country codes. These improvements make VCL syntax cleaner, tidier, and more reusable, encouraging developers to simplify and share their code within the Fastly Connect community.