Re: Ultra-short names Per Bothner (16 Aug 2015 17:29 UTC)
Re: Ultra-short names Per Bothner 16 Aug 2015 17:29 UTC
On 08/16/2015 10:20 AM, Per Bothner wrote:
> (! PATTERN VALUE)
> Evaluate VALUE and bind against the PATTERN. Most commonly PATTERN is
> a simple identifier (in which case it's like a 'define'), but it can
> include a type specifier or be a complex pattern.
> '|' also implies the bound names are constant (non-assignable)
> and local by default. (I.e. a file-level name is not exported.)
> '!' also disallows overriding definitions, to catch common errors,
> though this feature may need some tweaking.
> There is also:
> (? PATTERN VALUE)
> Can only be used in a conditional context (like an /if' or an 'and').
> If the VALUE matches against the PATTERN then the bindings are available
> if the 'then' clause of the 'if' (or in the case of an 'and', the
> following sub-expressions), and the boolean value is true.
> These extensions are relatively new: While the basic syntax was in the 2.0
> release, it wasn't really documented, awaiting the more general pattern
> framework, currently in the "invoke" Subversion branch.
Actually, it looks like '!' was not in the Kawa 2.0. It has been documented
for a while in the Kawa news page as a feature of the Subversion trunk, and
I've also mentioned it in various emails.
I chose '!' (unconditional binding) to contrast with '?' (conditional binding),
though some other other characters would also have worked.