Pliant talk forum
Discussion: Constants
|
Message posted by maybe Marcus on 2002/05/02 21:01:27 |
I have noticed that constant definitions are not mentioned in the documentation.
The syntax seems to be:
constant 'identifier' 'expression'
where expression is:
- a number, a string, or a previously defined identifier, or - expression 'operator' expression, where 'operator' is any Pliant operator, or - a call to a function or method
Am I missing something?
Could someone precise its semantics? |
Message posted by maybe Hubert Tonneau on 2002/05/02 21:13:45 |
'expression' can be anything.
It's just any Pliant expression, and it will simply be evaluated at compile time. |
Message posted by maybe Marcus on 2002/05/02 21:26:39 |
And what is a 'Pliant expression', precisely? |
Message posted by maybe Hubert Tonneau on 2002/05/02 21:40:02 |
> And what is a 'Pliant expression', precisely?
Anything that is a Pliant tree at parser level. Here are sample Pliant expressions: 12 a=15 or true # assuming that 'a' was previously declared as a global variable { gvar Int u := 3 ; for (gvar Int i) 1 5 { u *= i+4 } ; u } fact:a=120 # still assuming that 'a' was previously declared as a global variable (file_query "/tmp/foo" standard)=defined
|