No-op function?

Is there such a thing as a function that is a no-op (and returns nothing which I guess is always mandatory) for any arguments?

Basically

noop(args...; kwargs...) = nothing

I’m wondering if either

  1. something like this exists or
  2. this is something so simple that it’s not worth bothering to put in the standard library
  3. this isn’t something you should ever do because [reasons]

I suspect it’s most likely #4 :grinning_face_with_smiling_eyes:. This is in the context of a function with a function-typed arg that I’d like to have no-op as the default.

As of 4 hours ago, you can do this on 1.7-DEV with Returns(nothing). (#39794)

7 Likes

Well, I’ll be darned! :laughing:

Thanks!