-> is a literal syntax, for example, " . Its value is fixed by the language specification.
Kernel#lambda is a method, like any other method. It can be overridden, deleted, overwritten, neutralized, intercepted, ...
So, semantically, they are very different.
It is also possible that their performance is different. Kernel#lambda will at least have method call overhead. The fact that the runtime engine cannot really know what Kernel#lambda does at runtime (since it can be deactivated by both) also excludes any static optimizations, although I don't think that any existing ruby ββruntime engine statically optimizes lambda literals in any meaningful way.
source share