in reply to Re^5: Perl scoping not logical...?
in thread Perl scoping not logical...?

Hi Corion. You said "This idiom is frequently used and if somebody cannot read it, they should just learn Perl."

Sort of a side issue, maybe, but does this imply you might not agree with Damion Conway's idea of not using perl's "unless/until" operators because they are not as familiar to non-Perl programmers who might follow or is it more due to the frequency with which you perceive the idiom to be used?

If the idiom is frequently used (I've not seen it used that often, but perhaps its being frequently used because the feature is common more common in compiled languages more typically studied or taught in computer science and course work?

Perhaps I've had a different exposure , but didn't most of those languages that don't support it (other than C or C++...C++ doesn't? ) come out *after* perl and aren't all of them (or weren't all of them) designed as script languages? I tended to think lack of that feature fell into more primitive languages (from a compiler language perspective). Even "C" was was initially used was barely more more than a high level assembler in earlier Unix days.

I may be imagining or projecting things based on my limited exposure, but besides Pascal and Modula, I believe PL/M and it's predecessor PL/I and the majority of the few third generation computer languages that were developed. I don't remember if Ada had it or not. It seemed to be semantically rich. PL/M was more in use as a system language on Intel machines before C rose in popularity. I remember being saddened at the paucity of language semantics in 'C' when I started getting into more complex programs but I also seem to remember that languages that support Object oriented features like Classes/Packages and that supported multiple inheritance could be written with "pseudo" support for such -- since usually one doesn't need or use such features beyond 2nd' level functions, and many people seemed to employ Classes or Packages as 1st level procedures in languages that didn't have the better compiler support of HLL (High Level Language (implication being compiled, as they tended toward being based more on computer language theory than interpretive or scripting languages).

I'd always hoped that the scripting languages would game more language richness over time. So much is focused on the accompanying language library these days (many common library functions being 'keywords' n Perl), that not much development is going toward language semantics. I hoped Perl6 might take Perl5 in that direction, but from what little I've seen of it, it seems to be becoming a language as different from perl5 as ruby or or python -- more of a revolutionary development than evolutionary, but that may be subjective...

Replies are listed 'Best First'.
Re^7: Perl scoping not logical...?
by Corion (Patriarch) on Apr 28, 2008 at 14:31 UTC

    I disagree with many things that Damian Conway writes in his books. Learning Perl is important if you want to program in Perl.

    That you have not seen the idiom frequently used may be due to you not encountering situations where having a subroutine if a lexical scope is necessary.

    It may be due to your different exposure. Even though I only listed "recent" languages (Visual Basic dates from 1991), that is mostly because I remember the scoping rules for these quite well. I think the decision on whether support lexically scoped subroutines was made on a performance/implementation aspect. For lexically scoped subroutines, you need to do more housekeeping with the stack than on subroutines that do not allow such, at least for language implementations that allocate all variables on the stack. The "early" languages did that quite often, as the stack has hardware support while allocating from the heap is more expensive.

    If you're bent on categorizing C as a "scripting language", feel free to do so, but it detracts from whatever point you might be trying to make otherwise.

    As an aside, your run on sentences make your text hard to follow. You should try to take a step back and see whether your sentences are complete, contain matched sets of parentheses and whether the points you're trying to make are clear. I found many of your paragraphs very hard to follow and thus don't comment on them.