https://kotlinlang.org logo
Title
m

Michael Ortali

12/17/2020, 10:39 PM
👋 Do we have examples of generic decorators with kotlin? Is it even possible? I’m trying to achieve something similar to this in python:
def decorate(fn):
   def wrapper(*args, **kwargs):
     print("Decorated")
     return fn(*args, **kwargs)
   return wrapper

@decorate
def method(prop1, prop2):
  return prop1 * prop2
(I’ve seen this work with annotations, but curious to see if that’s possible to do with the
by
or other means)
Topic was brought in general about a year ago: https://kotlinlang.slack.com/archives/C0922A726/p1554400997221000. Just in case new things have come up since 🙂