Hi Luis, this and several other functions are simply part of my Common Lisp compatibility library. prog2 is simply a 3-ary function which returns the 2nd given value. the 1st argument is evaluated for side-effect at the call-site.
I still do not understand why you ask for a parameter that you won’t use.
But in any case, the answer is no, there is no way to name an argument that won’t be used.
Because, except when overriding, that is considered as a potential bug.
for the purpose of the question, you can imagine that it is a method which has 3 arguments in the parent class, or it is one of a set of functions which all need to have the same calling semantics for some reason.
scala> def foo(@unused a: String, b: String) = b
def foo(a: String, b: String): String
scala> def foo(a: String, b: String) = b
^
warning: parameter value a in method foo is never used
def foo(a: String, b: String): String
@charpov, can you please give me an example of how to write the function using this syntax? Does the annotation precede the function definition, or is it somehow embedded within the definition?