Re: [問題] Wrapping/Widening + Var-args
看板java作者AmosYang (LetMeGoogleThatForYou)時間15年前 (2010/09/09 11:50)推噓0(0推 0噓 0→)留言0則, 0人參與討論串5/5 (看更多)
※ 引述《tkcn (小安)》之銘言:
: 而因為這個 bug 的 priority 是 Vary Low,
: 所以拖了近六年至今還沒被處理掉....XD
http://download.oracle.com/javase/1.5.0/docs/guide/language/varargs.html
So when should you use varargs? As a client, you should take advantage
of them whenever the API offers them. Important uses in core APIs
include reflection, message formatting, and the new printf facility.
As an API designer, you should use them sparingly, only when the benefit
is truly compelling. Generally speaking, you should not overload a varargs
method, or it will be difficult for programmers to figure out which
overloading gets called.
Translation 1: Just because you can, it doesn't necessarily mean you should.
Translation 2: Don't f* do it. XD
If anyone's interested in this sort of (fun) stuff, read Eric Lippert's
blog. It's full of this kind of (fun) stuff. ;)
http://blogs.msdn.com/b/ericlippert/
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 65.87.177.87
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 5 之 5 篇):