Search code examples
programming-languagescompiler-theory

Is there any language where names can include space characters?


Is there any programming language that allows Names to include white spaces ? (By names, I intend variables, methods, field, etc.)


Solution

  • Scala does allow whitespace characters in identifier names (but for that to be possible, you need to surround the identifiers with pair of backticks).

    Example (executed at Scala REPL):

    Welcome to Scala version 2.8.0.final (Java HotSpot(TM) Client VM, Java 1.6.0_22).
    Type in expressions to have them evaluated.
    Type :help for more information.
    
    scala> val `lol! this works! :-D` = 4
    lol! this works! :-D: Int = 4
    
    scala> val `omg!!!` = 4
    omg!!!: Int = 4
    
    scala> `omg!!!` + `lol! this works! :-D`
    res0: Int = 8