This may seem like a dumb question, but still I don t know the answer.
Why do programming languages not allow spaces in the names ( for instance method names )?
I understand it is to facilitate ( allow ) the parsing, and at some point it would be impossible to parse anything if spaces were allowed.
Nowadays we are so use to it that the norm is not to see spaces.
For instance:
object.saveData( data );
object.save_data( data )
object.SaveData( data );
[object saveData:data];
etc.
Could be written as:
object.save data( data ) // looks ugly, but that s the "nature" way.
If it is only for parsing, I guess the identifier could be between .
and (
of course, procedural languages wouldn t be able to use it because there is no . but OO do..
I wonder if parsing is the only reason, and if it is, how important it is ( I assume that it will be and it will be impossible to do it otherwise, unless all the programming language designers just... forget the option )
EDIT
I m ok with identifiers in general ( as the fortran example ) is bad idea. Narrowing to OO languages and specifically to methods, I don t see ( I don t mean there is not ) a reason why it should be that way. After all the .
and the first (
may be used.
And forget the saveData
method , consider this one:
key.ToString().StartsWith("TextBox")
as:
key.to string().starts with("textbox");