Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Re: Productivity and Perl

by ariels (Curate)
on Jun 02, 2002 at 09:33 UTC ( [id://171002]=note: print w/replies, xml ) Need Help??


in reply to Re: Productivity and Perl
in thread Productivity and Perl

Actually, your 2 examples are misleading. Common Lisp (which is what Graham usually writes about) does have catch and throw. On the other hand, it doesn't have <samp>call-with-current-continuation</samp>; that's Scheme.

Of course, even with Scheme, you wouldn't be using <samp>call/cc</samp> in your code directly; you'd be using the famed macros to have something nicer.

Replies are listed 'Best First'.
Re: Re: Re: Productivity and Perl
by educated_foo (Vicar) on Jun 02, 2002 at 14:57 UTC
    You caught me -- my "lisp" experience such as it is consists of Scheme and Emacs Lisp. My example may have been inaccurate, but I wouldn't say it is misleading. The point is just that Java expresses the same things in more words (or lines). While writing a function in either language, you spend some time deciding to use a particular approach, then some more typing it in. I'd say the "thinking about it" part takes about the same amount of time for similar things. Then you go to type them in, and the Java one has more lines, but it's probably faster per-line to write. Last time I programmed in Java, I even had a macro for
    } catch (IOException e) { // Loathe Java System.out.println("IO error: " + e); }
    Which gave me 4 lines (ok, 3 lines) almost for free. Certainly, these 4 lines are much more quickly generated than 4 lines of quasiquoted macro glop in Lisp.

    /s

      You caught me -- my "lisp" experience such as it is consists of Scheme and Emacs Lisp.

      This may also have influenced your perception of Lisp's object system; I don't think that CLOS is awkward at all, and it certainly needn't involve mucking about with closures in any way (although an implementor could do it that way if desired, I suppose).

      Also, though Common Lisp does have catch and throw, they're not typically the way (at least in their raw form) one would handle errors. Better to use the condition system which is provided for that very purpose and which is quite powerful. Kent Pitman (one of the authors of the part of the spec about conditions) has some articles which I'm too lazy to find pointers to right now. The chapter in the spec on conditions is perfectly readable to get a start in the right direction on using it. (In short, to get Java-like functionality, one can define errors using define-condition, "throw" them using error, and "catch" them using hander-case. This suffices to do a lot. Then one can learn to use the rest of the system to do all kinds of other miraculous and fascinating things :-) - Pitman's papers will probably give a better explanation than I.)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (4)
As of 2024-03-19 07:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found