Zach Beane (xach) wrote,

package::(...) syntax

For a long time, Allegro CL has allowed a syntax like this:

foo::(bar baz quux)

The "foo::" prefix reads the subsequent sexp as though the current package was the "foo" package.

SBCL 1.0.55 introduced support for this syntax as well. I've started to use it more and more, because I sometimes enter stuff like this at the REPL:

(ql-dist:ensure-installed (ql-dist:system "foo"))

Now I can use this:

ql-dist::(ensure-installed (system "foo"))

It saves me the trouble of inheriting or importing symbols, or switching packages, for simple one-off stuff in the REPL. I don't use it in source files — I don't feel like being that gratuitiously unportable.

Thanks to Nikodemus Siivola for adding this capability to SBCL.

Tags: lisp
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded  

  • 3 comments