Hacker News new | past | comments | ask | show | jobs | submit login

> Curious. Are there examples of programming languages that allow spaces in identifiers? Obviously, it would need to be designed for that.

At least Tcl allows spaces in identifiers, but to 'use' such identifiers one does have to add a bit of extra 'sugar' to prevent the code parser from interpreting the spaces as token separators:

Example of spaces in a variable name:

    $ rlwrap tclsh 
    % set "var name with spaces" "contents of the variable"
    contents of the variable
    % puts ${var name with spaces}
    contents of the variable
    % set "var name with spaces"
    contents of the variable
Example of spaces in a procedure (function) name (the first line defines the procedure):

    % proc {my space proc} {string} {puts "'my space proc' called with string='$string'"}

    % {my space proc} "hello how are you"
    'my space proc' called with string='hello how are you'
    % "my space proc" "the quick brown fox"
    'my space proc' called with string='the quick brown fox'
    % set pn "my space proc"
    my space proc
    % $pn "this that and the other"
    'my space proc' called with string='this that and the other'
So there you have at least one example.



Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: