5 ms·
I’m sure we can come up with a language where three dots separated by spaces is valid syntax.
by layer8 3y ago
I’m sure we can come up with a language where three dots separated by spaces is valid syntax.
- deleted 3y ago[deleted]
- __s 3y agoBefunge
- masklinn 3y agoBrainfuck, as well. And technically Whitespace though that's maybe not as useful.
- unnah 3y agoA non-esoteric answer: in Forth dot prints the top of the stack and function calls are separated by spaces. Hence three dots separated by spaces is the simple and straightforward way to print the top three stack elements.
- Just_Harry 3y agoIt's valid in PowerShell, if "." is defined as a function: PS> function . {$Args} PS> . . . . The first dot is an operator which invokes a command in the current scope, the second dot is our command ".", and the third dot is passed to the command as a string.
- trealira 3y agoYou can also do this in Bash. $ .(){ "$@"; } # define function called "." $ . . . # nothing $ . echo hello hello $
- trealira 3y agoYou can write a function in Bash like this: .(){ :; } This creates a function called "." that does nothing. Then this is valid code: . . .
- still_grokking 3y agoIt works (almost) in Scala: def `. . .` = println("That's valid syntax!") @main def entryPoint = `. . .` [ https://scastie.scala-lang.org/BsvbSctXTmaGWaCbM6JX9Q https://scastie.scala-lang.org/BsvbSctXTmaGWaCbM6JX9Q ] I said almost because HN suppresses the back-ticks…