Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy do programming languages not allow spaces in identifiers?
    primarykey
    data
    text
    <p>This may seem like a dumb question, but still I don't know the answer. </p> <p>Why do programming languages not allow spaces in the names ( for instance method names )?</p> <p>I understand it is to facilitate ( allow ) the parsing, and at some point it would be impossible to parse anything if spaces were allowed. </p> <p>Nowadays we are so use to it that the <em>norm</em> is not to see spaces. </p> <p>For instance:</p> <pre><code> object.saveData( data ); object.save_data( data ) object.SaveData( data ); [object saveData:data]; </code></pre> <p>etc. </p> <p>Could be written as:</p> <pre><code> object.save data( data ) // looks ugly, but that's the "nature" way. </code></pre> <p>If it is only for parsing, I guess the identifier could be between <code>.</code> and <code>(</code> of course, procedural languages wouldn't be able to use it because there is no '.' but OO do..</p> <p>I wonder if parsing is the <em>only</em> 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 ) </p> <p><strong>EDIT</strong></p> <p>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 <code>.</code> and the first <code>(</code> may be used.</p> <p>And forget the <code>saveData</code> method , consider this one:</p> <pre><code>key.ToString().StartsWith("TextBox") </code></pre> <p>as:</p> <pre><code>key.to string().starts with("textbox"); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload