Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Why don't languages or IDEs support attaching descriptive metadata to variables? (softwareengineering.stackexchange.com)
4 points by azeemba on Aug 12, 2024 | hide | past | favorite | 2 comments


You can put arbitrary metadata on functions, classes and other things that are basically objects in in Python. If you write

   def somefunction(x):
      ... body ...
you can later write

   somefunction.specialmetadata = "a value"
so what you can do is fairly unlimited. You can't write, however

   x = 4
   x.metavalue = 3
as the int isn't a general object. Even if you did the metadata would apply to the value (the '4') and not the variable (the 'x')


Clojure supports metadata:

https://clojure.org/reference/metadata




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: