7
I have been working on VCL expressions recently, and we are approaching
10
The data types in VCL are "sort of weird" seen with normal programming
11
language eyes, in that they are not "general purpose" types, but
12
rather tailored types for the task at hand.
14
For instance, we have both a TIME and a DURATION type, a quite
15
unusual constellation for a programming language.
17
But in HTTP context, it makes a lot of sense, you really have to
18
keep track of what is a relative time (age) and what is absolute
21
Obviously, you can add a TIME and DURATION, the result is a TIME.
23
Equally obviously, you can not add TIME to TIME, but you can subtract
24
TIME from TIME, resulting in a DURATION.
26
VCL do also have "naked" numbers, like INT and REAL, but what you
27
can do with them is very limited. For instance you can multiply a
28
duration by a REAL, but you can not multiply a TIME by anything.
30
Given that we have our own types, the next question is what
31
precedence operators have.
33
The C programming language is famous for having a couple of gottchas
34
in its precedence rules and given our limited and narrow type
35
repetoire, blindly importing a set of precedence rules may confuse
36
a lot more than it may help.
38
Here are the precedence rules I have settled on, from highest to
42
'true', 'false', constants
69
'==', '!=', '<', '>', '~' and '!~'
71
string existence check (-> BOOL)
83
Input and feedback most welcome!
87
Poul-Henning, 2010-09-21