AS3から”_x”が”x”になるという話だったけど、これって結構モーション系のクラスの中で使用している変数名の気がする。むぅ・・。
“_”付の変数名は将来的にプロパティになる可能性があるということで、推奨しないという話だったのに、そうとみせかけて、こう!みたいな・・。
AS3から”_x”が”x”になるという話だったけど、これって結構モーション系のクラスの中で使用している変数名の気がする。むぅ・・。
“_”付の変数名は将来的にプロパティになる可能性があるということで、推奨しないという話だったのに、そうとみせかけて、こう!みたいな・・。
We use cookies to improve your experience on our site. By using our site, you consent to cookies.
Manage your cookie preferences below:
Essential cookies enable basic functions and are necessary for the proper function of the website.
These cookies are needed for adding comments on this website.
Google reCAPTCHA helps protect websites from spam and abuse by verifying user interactions through challenges.
Google Tag Manager simplifies the management of marketing tags on your website without code changes.
Statistics cookies collect information anonymously. This information helps us understand how visitors use our website.
Google Analytics is a powerful tool that tracks and analyzes website traffic for informed marketing decisions.
Service URL: policies.google.com (opens in a new window)
Marketing cookies are used to follow visitors to websites. The intention is to show ads that are relevant and engaging to the individual user.
A video-sharing platform for users to upload, view, and share videos across various genres and topics.
Service URL: www.youtube.com (opens in a new window)
You can find more information in our Cookie Policy and Privacy policy.
「そっちかー」への4件の返信
ども。
“_”から始まる変数名ですが、ボクは前からプライベート変数につけてました。
このルールは知り合いのPerl野郎から聞いた話で、書籍では見たことなかったんですが、気になったので検索してみたらそういう記述が。
http://www.melma.com/backnumber_14785_1152969/
(Perl界ではものすごく著名な方です)
そこには、
外部からアクセスされないようにするための紳士協定が、”_” (アンダースコ
ア) です。_ を変数名やメソッド名の先頭につけた場合、これは Private だ
から外からアクセスしないように、という意味になります。
だそうです。
でもこれってPerlだけの話、なのかな?
ボクはAS2のクラスでガンガン書いてますけど。。
昔マクロメディア関係の人に”_”が頭につく変数は将来的にプロパティとして使われる可能性があるので、あまり使わないほうがいいですよ・・。といわれた記憶があります。なので、私はもっぱら$を使っています。(ただ一括選択できないので不便ですが・・・)
ドキュメントの中にかいてあるかなああ?と思って探してみましたが、まったく見つからなかったので夢かもしれませんw
あ、自分も”_”はあんまり使わない方がいいって書かれた何かを見たことありますよー。
思い出せませんが・・・。
“$”はいいっすね、絶対にかぶらなさそうですし。
>”$”はいいっすね、絶対にかぶらなさそうですし。
でもなんかタイプしづらいです。今後は”_”で行こうかなと・・。