So that the compiler or interpreter knows the extent of the variable token. Without spaces allowed you would need some other way to tell it where they start and end, like quotes or a special declaration, which would be harder for the brain to parse. If you know a better way please share it.
I am not picturing why this is true, if you cannot use key words as parts of variables (alone separated by a space) and lines end with a newline or semicolon (some symbol)
The first restriction might make this a problem.
I am not saying it is a good idea, but it is not obvious to me.
Removing keywords from variables is a big sacrifice when they are often such common glue words, like `and`, `or`, `if`, etc. Say `and` is the keyword and you want a variable called foo_and_bar. To get such words back you would need to add something so that the parser knows if
foo and bar == true
means
foo && bar == true
or
foo_and_bar == true
?
You could fix it with ugliness like making the keyword `@and` or some such, or the variable `foo @and bar` but that's not an improvement.
Yes, it is, but it would also change the language, it is funny I forget c++ has “and” because && is so ubiquitous.
Likely you will get changes so “if” is ? Or something.
(Like we wee with ternary operator)
Like I said, I can’t picture the requirement, but am not sure it is a good idea.
> Without spaces allowed you would need some other way to tell it where they start and end
That's not a problem at all, as long a a newline isn't treated as space and you don't use ML style function application, where a space is used to separate the argument(s) from the function name - `f x` instead of `f(x)`.