Perl Best Practices [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Perl Best Practices [Electronic resources] - نسخه متنی

Damian Conway

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید







3.5. Underscores


Use underscores to separate words in multiword identifiers .


In English, when a name consists of two or more words, those words are typically separated by spaces or hyphensfor example, "input stream", "key pressed", "end-of-file", "double-click".

Since neither spaces nor hyphens are valid characters in Perl identifiers, use the next closest available alternative: the underscore. Underscores correspond better to the default natural-language word separator (a space) because they impose a visual gap between the words in an identifier. For example:


FORM:
for my $tax_form (@tax_form_sequence) {
my $notional_tax_paid
= $tax_form->{reported_income} * $tax_form->{effective_tax_rate};
next FORM if $notional_tax_paid < $MIN_ASSESSABLE;
$total_paid
+= $notional_tax_paid - $tax_form->{allowed_deductions};
}

TheAlternativeInterCapsApproachIsHarderToReadAndInParticularDoesn'tGeneralizeWellToALLCAPSCONSTANTS:


FORM:
for my $taxForm (@taxFormSequence) {
my $notionalTaxPaid
= $taxForm->{reportedIncome} * $taxForm->{effectiveTaxRate};
next FORM if $notionalTaxPaid < $MINASSESSABLE;
$totalPaid
+= $notionalTaxPaid - $taxForm->{allowedDeductions};
}


/ 317