Liste des Groupes | Revenir à cl c |
On 08/11/2024 17:37, Janis Papanagnou wrote:>
BTW, the same symbols can also be used as an alternative form
of the 'case' statement; the semantic distinction is made by
context, e.g. the types involved in the construct.
You mean whether the 'a' in '(a | b... | c)' has type Bool rather than Int?
I've always discriminated on the number of terms between the two |s:
either 1, or more than 1.
Bart, out of interest; have you invented that syntax for your
language yourself of borrowed it from another language (like
Algol 68)?
It was heavily inspired by the syntax (not the semantics) of Algol68,
even though I'd never used it at that point.
I like that it solved the annoying begin-end aspect of Algol60/Pascal
syntax where you have to write the clunky:
[snip examples]
I enhanced it by not needing stropping (and so not allowing embedded
spaces within names); allowing redundant semicolons while at the same
time, turning newlines into semicolons when a line obviously didn't
continue; plus allowing ordinary 'end' or 'end if' to be used as well as
'fi'.
My version then can look like this, a bit less forbidding than Algol68:
if cond then
s1
s2
else
s3
s4
end
Les messages affichés proviennent d'usenet.