[Openmcl-devel] Semi-newbie questions

Gary Byers gb at clozure.com
Thu Apr 8 20:59:43 PDT 2004



On Thu, 8 Apr 2004, Stonewall Ballard wrote:

> I'm trying to understand how OpenMCL works. I'm optimistic that this
> can be made into something really usable, and my being able to access
> the whole thing and rebuild it is ideal.
>
> I have a long background in implementing and using dynamic languages,
> particuarly Smalltalk, but I use C++ nowadays for my main work and have
> not done a lot of CL programming, so, if you'll bear with me, I have
> some basic questions.
>
> * In l0, I see things like
> (defun functionp (arg)
>      (functionp arg))
>
> Is this defining a compiler intrinsic for use by interpreted code?


Probably.  In "ccl:lib;level-2.lisp", there's a whole batch of these
things defined inside a local macro called EVAL-REDEF.  A few things
may need to exist earlier in  the "cold load" (the environment where
the initial fasl files are loaded.)

>
> * What exactly does it mean for a symbol to have a "%" prefix?

It's a convention that indicates that the function is internal/private
and/or unsafe.  CDR will signal an error if its argument isn't a list;
CCL::%CDR will skip a few type-checking instructions and blindly
access memory.

>
> * What does it mean to bracket a variable like "%foo%"?

Roughly the same thing.

>
> * In l0-init.lisp, it defines *features*, which is used by #+ and #-
> for conditional eval, but how is it possible to use #+ within the
> initial value of *features*? I'm going to guess that it's using the
> values from the runtime environment to define a symbol in the
> compile-time environment.

Yes.

>
> * Is "require" part of the defsystem stuff, or is it independent?

REQUIRE moved out of CL about 15 years ago, and then moved back in.
DEFSYSTEM is a horrible anacronism.

>
> * How does the "require" function know where to look for things that
> can be loaded?
>
> * Is the OpenMCL compiler capable of working with unboxed 32-bit
> fixnums, with appropriate declarations and scope limitations? I'd love
> to use CL for my image hacking, but so much of it requires
> highly-efficient processing of 2D arrays of 32-bit or 64-bit integers
> (possibly interpreted as ARGB pixels with 8 or 16-bit channels). I
> imagine that I can use LAP, but I'd rather not.

It has some support for doing arithmetic on operands of type (UNSIGNED-BYTE
32), but you generally have to jump through a bunch of hoops to avoid
consing. One problem is that the compiler tends to believe that named
variables always need to be boxed.

>
> * Is there any advantage to writing
>
> (let* ((foo 4))
>     ...
>
> Rather than
>
> (let ((foo 4))

In the one arg case, they're exactly the same.

>    ...
>
> I've seen some use of let* with only one var, but I thought the only
> difference between let and let* was whether or not the initializers
> were eval'd before or after the preceding var bindings were made (aka
> sequential vs. parallel). Seeing this made me wonder if there was
> something else happening.

I've found that I almost never mean to say LET, and am just in the habit
of saying LET*.   I've done it for so long that I don't see anything
unusual about doing so.

>
> Thanks for any help in clarifying these things for me.
>
>   - Stoney
>
> --
> Stonewall Ballard                    Stonetics, Inc.
> sb at stonetics.com           http://www.stonetics.com/
>
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel
>
>



More information about the Openmcl-devel mailing list