Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re: Perl Will Stay a Dynamic Language

by Anonymous Monk
on May 01, 2006 at 22:41 UTC ( #546785=note: print w/replies, xml ) Need Help??

in reply to Perl Will Stay a Dynamic Language
in thread Syntax checking without BEGIN blocks

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re^2: Perl Will Stay a Dynamic Language
by chromatic (Archbishop) on May 02, 2006 at 07:55 UTC
    The language can't be safely syntax checked, and thus can't be safely debugged, either, right?


    You might like pre-monadic Haskell.

    I'm told flat out that no one is willing to fix this, I'm accused of emotional blackmail for wanting to work with a language that can be debugged?

    How else would you characterize "If you guys won't fix this, I'll go off and use another language! Nyah nyah!"?

    I'm not a compiler's guy...

    ... thus I mistrust your analysis of the problem!

    You've as yet to show me something good that can be done with dynamic features that can't be done without them.

    I know how this argument goes. I give a list of features. You come back to each one with "I've never used that" or "I don't know why anyone would need that" or "You can do that with an IDE" or "That makes maintenance hard" or "Wow, no novice could ever understand that." Still:

    • Run-time code generation
    • Closures
    • Cheap reflection
    • Extremely cheap proxying
    • Load-as-needed
    • In-process bug fixing
    • Universal mock objects
    • Overloading built-ins
    • Nominal typing
    • Genericity
    • Dynamic scoping
    • Conditional compilation
    • In-process code replacement
    • REPL
    • On-demand function and method creation
    • Caching for on-demand function and method creation
    • Incremental development
    I think I know the reason. Some guy on the team thought it would be "fun", and didn't think of the business costs involved in that decision.

    John McCarthy proved that wrong over fifty years ago. It's well worth your time learning why it's important.

    Correct code is the most basic issue in computing...

    Working code is the most basic issue in computing.

    You're arguing for dynamic features that prevent safe debugging...

    Again, untrue.

    ... and can greatly increase the maintenence effort.

    Completely untrue. I don't have to maintain code I don't have to write. Every getter and setter I have to write in Java is code I have to maintain. I don't care if my IDE does it for me. It's still code. Every getter and setter I can autogenerate in Perl by storing a closure in the symbol table (better yet, looping over it) is code I don't have to maintain.

    It's not dynamic code that's the maintenance problem. It's poorly-factored, repetitive code. A language that can't provide sufficient abstractions to eliminate repetition and improve factoring is insufficiently powerful.

    I know firsthand just what a mess dynamic code typically is...

    Don't write messy code. Problem solved. (I refuse to believe that you can't write clean dynamic code. You can't write tests? You can't choose good symbol names? You can't find a clean design? Really? Truly?)

    ... how do you offset the increased effort in understanding the vastly increased complexity of dynamic code, and the maintenance nightmares it typically incurs?

    There's less code. OAOO. DRY. What is difficult to understand about these principles? Where is the maintenance nightmare typically incurred by auto-generated accessors or imported functions or higher-order-functions or polymorphic genericity or runtime decoration?

    If improved abstraction makes your code easier to write, less repetitive, more concise, more generic, and more reusable, what exactly is the problem? Is it the lack of provability? That's silly! The last completely provable program I wrote calculated the Fibonacci series! Hooray. (The last almost-provable program I wrote calculated square roots and I deliberately left a trivial math bug in it to see if the compiler would catch it. It didn't.)

    How can you claim that said benefits mitigate in any way the risk of losing the entire codebase to a disgruntled employee's code?

    Because I can think of dozens of better ways for a disgruntled employee to cause damage than by oh-so-subtly sneaking something scary into a BEGIN block in an obscure module somewhere. Really, if your system is so fragile that that could ruin your work, your work is already ruined. You just don't know it yet.

    I admit I can't see any of the real benefits to the dynamic approach to perl...

    Class::DBI, Tie::File, strict, diagnostics, Class::MockObject, Exporter, Class::Accessor, English, Shell, CGI, DynaLoader, Data::Dumper, DBI, Test::MockObject, Class::Trait, IO::Prompt....

    I've explained what's wrong with the perl syntax checker and debugger...

    No, you've only explained that you want something that isn't Perl. You've claimed obliquely to have discovered something serious that no one who's ever patched Perl has ever thought of (or cared about), as if we're all amateurs just donating our time and energy and effort for kicks and not actually doing serious work ourselves for even ungrateful people who accuse us of being thoughless and careless and not serious and lazy and tell us if we don't fix things, you'll just go off and harass someone else.

    Other people have told you why Perl runs BEGIN blocks and why, in general, a Perl syntax checker has to do so. Believe that or don't believe it. I don't care.

    At least someone should have told you that syntax checking is useless in the general case and that what you really need instead is semantics checking. Unfortunately, computers can't do that. (That's why I write copious tests.)

    If you don't understand how anyone could possibly like a dynamic language, that's one thing. Preferring a static language is fine too.

    Yet to condemn volunteers who've spent years creating something that you use and giving it away for you to use or not use for free and claiming that those volunteers don't really get it and are deliberately making your life harder, well, that's a lot difficult for me to swallow. You wandered into a discussion of language philosophy -- a discussion that's over fifty years old. Don't assume that the rest of us are unfamiliar with many sides of the issue.

    A reply falls below the community's threshold of quality. You may see it by logging in.
Re^2: Perl Will Stay a Dynamic Language
by cees (Curate) on May 01, 2006 at 23:41 UTC
    Wait! The language can't be safely syntax checked, and thus can't be safely debugged, either, right? (Any hostile code won't be intercepted until after the initial syntax check, by which time it's too late.)

    Can you explain to me how a syntax check can detect hostile code? Your whole premise seems to depend on this and I can't see how it relates...

    If the syntax check fails, then I would assume that the code will not execute (you will get a compiler error)! And if the syntax check passes, all that tells you is that the program will execute without a compiler error. Nowhere would it say 'Syntax check failed because of hostile code'. So what does a syntax checker gain you here in added safety?

    I'm just a little confused about what you are actually trying to accomplish here...

    ps I did read all the posts in the thread, but I may have missed something. Appologies if I did...

Re^2: Perl Will Stay a Dynamic Language
by ikegami (Pope) on May 03, 2006 at 16:49 UTC
    I like perl; but if I can't trust it, I can't in good concience use it anymore.

    Be sure to avoid programs written in C, C++, Java and Visual Basic (for starters). All of these can load code dynamically as well.

    A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://546785]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2021-03-08 21:49 GMT
Find Nodes?
    Voting Booth?
    My favorite kind of desktop background is:

    Results (128 votes). Check out past polls.