We need a standard for this. When I'm writing example code, or redacting real code, I usually opt for an ellipses with spaces: `. . .`
We need a standard for this. When I'm writing example code, or redacting real code, I usually opt for an ellipses with spaces: `. . .`
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. $ .(){ "$@"; } # define function called "."
$ . . . # nothing
$ . echo hello
hello
$ .(){ :; }
This creates a function called "." that does nothing.Then this is valid code:
. . . def `. . .` = println("That's valid syntax!")
@main def entryPoint = `. . .`
[ https://scastie.scala-lang.org/BsvbSctXTmaGWaCbM6JX9Q ]I said almost because HN suppresses the back-ticks…
def will_implement_later():
...
Which I prefer over "pass" in this case because the incompleteness is a little more intuitive.I think using asterisks for wildcardy-things like variadic args makes more sense too, coming from UNIX land.
(In this case, the article used them as valid syntax and added a comment to clarify that this is indeed valid syntax!)
If that isn't what you were doing, and it still isn't clear enough, add some text to the comment about what the "intentionally omitted part" was that you covered by an ellipsis.
let x = 5 + todo!("Complicated arithmetic expression");
... is valid Rust, it typechecks, your syntax highlighter should be fine with it, it'll compile, but if that line ever executes, you panic immediately.I use them heavily during development. Most of my new functions in progress end with an unimplemented!
I'm not sure what advantage at all could be gained by preventing it from compiling, other than to save people who copy code without even looking at it some minor inconvenience.
Edit: I suppose if you really wanted an existing macro to cause compilation to fail, you could use https://doc.rust-lang.org/std/macro.compile_error.html
But I think that's a strange use of it.
Don't make language features that use three-dot-ellipsis as a keyword. Just like don't make a language where "Hello world" is a special string with special significance, or where variables named foo, bar, baz, quux, or i have special meaning.
I mean, it's nobody's fault but your own if you make a language feature that breaks industry conventions.