How is this not a type error?
As you showed yourself, array elements are enclosed in curly brackets. But, yes, I may pick a better syntax for this. Some ideas for this, if interested?
For that matter, why bother sticking with C's nonsense type syntax at all?
What do you suggest adopting instead?
TBH, the Pascal/Ada syntax, while slightly more verbose, always made more sense to me:Pascal
(* unlike Pascal, Modula-2 is case-sensitive, Ada
and all keywords are in ALLCAPS *)
b: POINTER TO CHAR;
type char_access is access character;
-- because Ada does not permit type equivalence, you never declare a
-- a single variable as 'access foo', because that would make it a
-- unique type; two variables, each declared 'access foo' but in
-- separate declarations, would not be considered to be of the
-- same type.
Then again, I also prefer the Algol/Pascal/Ada assignment operator :=
, too; it makes it clear that you are setting a value, rather than asserting equality. A left arrow or left-bracket/hyphen combination <-
would make even more sense to me, though.