Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • "list" is already a function name, so I wouldn't use it as a variable. This wouldn't happen if the language had sigils...
    • This isn't a problem. Symbols get their values from different "slots" depending on context. When you write (list 'foo 'bar), list is called as a function. When you write (setq list 42) and then (+ list list), you get 84. It's very clear. The only problem is calling a function saved in the value slot of a symbol: (defun foo (a b) (- a b)) (let ((foo (lambda (a b) (+ a b)))) (foo 2 1) ; 1 (funcall foo 2 1)) ; 3 Oh well, you can't have everything.
      • This isn't a problem.

        ... not for the compiler anyway. Some of the rest of us like to optimize for the slower parts of the process, often known as wetware.

        • by jrockway (7171) on 2008.01.31 21:32 (#60801) Journal
          FWIW, Perl suffers from this problem, sort of:

          sub foo {}
          my $foo = sub {};
          my $foo = "hello";
          $foo->(); # death

          Anyway, lisp is what it is.  It's straightforward to write a macro such that:

          (with-sigils (&foo) (foo $foo))

          expands to

          (progn (funcall foo) (foo foo)))

          If you really care I'll try it out and blog the code :)