ActionScript/Flex:为什么 AsyncToken 的 apply{Fault,Result} 方法是内部的?

发布于 2024-08-08 16:31:01 字数 189 浏览 3 评论 0原文

正如标题所示,为什么AsyncTokenapplyResultapplyFault方法被标记为mx_internal

有几次我想在代码中使用 AsyncToken,但最终我重写了它,因为我不想强制客户端使用命名空间mx_internal。

As the title suggests, why are the applyResult and applyFault methods of AsyncToken marked mx_internal?

There have been a few times that I would have liked to use AsyncToken in my code, but I've ended up re-writing it because I don't want to force clients to use namespace mx_internal.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

十秒萌定你 2024-08-15 16:31:01

如果您构建了此类,您希望对普通用户隐藏该功能,因为您不希望他们错误地调用这些方法,但创建它们的内部类需要调用它们,因此将它们标记为 mx_internal很好的感觉。

If you'd built this class you'd want to hide the functionality away from normal users, as you don't want them mistakenly invoking the methods, but the internal classes that create them need to invoked them, therefore marking them as mx_internal makes good sense.

┼── 2024-08-15 16:31:01

好吧,正如 livedocs 中的某处所述(我认为)mx_internal 用于标记框架中可能随时间变化的内容(显然他们认为 C# 和 Java 对已弃用的内容做错了)。至于这些特定方法被标记为 mx_internal 的确切原因,只有标记它们的开发人员知道。他们可能有一天会面讨论这个问题,内容如下:“嘿。我们想要这些方法获得什么访问权限”“我不知道,我们是否希望它们可以被重写?” “不确定”“好吧,让我们将它们设为 mx_internal”。在很多情况下,本应标记为 protected 的方法被标记为 mx_internal(或 private,在某些情况下更糟糕),这是 Flex 框架中最烦人的事情之一。

另外,无论您是否需要,您都在使用 mx_internal 命名空间,因为框架中的大多数组件都会导入它,因此如果您使用 Flex 框架组件,您的构建已经包含它。

Well, as stated somewhere in the livedocs (I think) mx_internal is used to mark things in the framework that might change over time (apparently they thought C# and Java are doing it wrong with the deprecated stuff). As to the exact reason why those particular methods are marked mx_internal only the developer that marked them knows. They probably met one day to discuss it and it went something like: "Hey. What access do we want for those methods" "I don't know, do we want them to be overridable?" "Not sure" "Ok, let's make them mx_internal then". There were many cases where methods that should have been marked protected were marked mx_internal (or private which is even worse in some cases) instead, and it's one of the most annoying things in the flex framework.

Also, you're using the mx_internal namespace whether you want it or not, because most of the components in the framework import it, so if you use the flex framework components, your build already includes it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文