TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Why don't languages or IDEs support attaching descriptive metadata to variables?

4 点作者 azeemba9 个月前

2 条评论

PaulHoule9 个月前
You can put arbitrary metadata on functions, classes and other things that are basically objects in in Python. If you write<p><pre><code> def somefunction(x): ... body ... </code></pre> you can later write<p><pre><code> somefunction.specialmetadata = &quot;a value&quot; </code></pre> so what you can do is fairly unlimited. You can&#x27;t write, however<p><pre><code> x = 4 x.metavalue = 3 </code></pre> as the int isn&#x27;t a general object. Even if you did the metadata would apply to the value (the &#x27;4&#x27;) and not the variable (the &#x27;x&#x27;)
thesuperbigfrog9 个月前
Clojure supports metadata:<p><a href="https:&#x2F;&#x2F;clojure.org&#x2F;reference&#x2F;metadata" rel="nofollow">https:&#x2F;&#x2F;clojure.org&#x2F;reference&#x2F;metadata</a>