From: Alberto Lavelli
Subject: A couple of doubts: boxing/unboxing, mixin
Date: 
Message-ID: <81h6ga$p2m$1@fe1.cs.interbusiness.it>
I have a couple of doubts concerning the terminology used in some
recent messages in the newsgroup:

 - boxing/unboxing numbers
 - mixin server (and more generally the concept of mixin)

Are they specific to Lisp or generic to computer science?
Could someone please point out where can I find more details on
these two concepts?


thanks in advance

	alberto

From: John Watton
Subject: Re: A couple of doubts: boxing/unboxing, mixin
Date: 
Message-ID: <81i7eo$qd7$1@nnrp1.deja.com>
In article <············@fe1.cs.interbusiness.it>,
  ·······@irst.it (Alberto Lavelli) wrote:
>
> I have a couple of doubts concerning the terminology used in some
> recent messages in the newsgroup:
>
>  - boxing/unboxing numbers
>  - mixin server (and more generally the concept of mixin)
>
> Are they specific to Lisp or generic to computer science?
> Could someone please point out where can I find more details on
> these two concepts?

I will let someone else explain mixin. I hope the following information
specific to the Franz ACL product is helpful to you. It is my
impression that any language which is not statically typed will have
boxing of numbers.

From the Franz ACL5.0 documentation at:
http://www.franz.com/support/docs/5.0/doc/cl/compiling.htm
9.5 Explain boxing

A number is boxed when it is converted from its machine representation
to the Lisp representation. For floats, the machine representation is
one (for singles) or two (for doubles) words. Lisp adds an extra word,
which contain a pointer and a type code. For fixnums, boxing simply
involves a left shift of two bits. For bignums which are in the range
of machine integers, boxing again adds an additional word.

Boxing obviously involves a computational overhead, but more important
it involves a space overhead. If a calculation involves the calculation
of thousands of floats, for example, thousands of bytes of space will
be used. Often that space need not be used. Let us consider a simple
example. darray is a vector of double floats. The function foo-insert
takes a vector, an index, and a double float as arguments, does
something to the double float (adds 2.0d0 but it could be anything) and
stores the result into the vector at the indicated index. Suppose
things were defined as follows:

--
John Watton
Alcoa Inc.


Sent via Deja.com http://www.deja.com/
Before you buy.
From: Kristoffer Kvello
Subject: Re: A couple of doubts: boxing/unboxing, mixin
Date: 
Message-ID: <u1z9fothr.fsf@mindless.com>
John Watton <···········@alcoa.com> writes:

> The function foo-insert
> takes a vector, an index, and a double float as arguments, does
> something to the double float (adds 2.0d0 but it could be anything) and
> stores the result into the vector at the indicated index. Suppose
> things were defined as follows:
> 
> --
> John Watton
> Alcoa Inc.
> 

This is what is usually referred to as a 'cliff-hanger', isn't it?
From: Tim Bradshaw
Subject: Re: A couple of doubts: boxing/unboxing, mixin
Date: 
Message-ID: <ey31z9e8xfx.fsf@lostwithiel.tfeb.org>
* Alberto Lavelli wrote:
>  - mixin server (and more generally the concept of mixin)

a `mixin' is a class which is intended to provide some kind of easily
factorisable functionality which can be `mixed in' to some other class
to allow it to provide that functionality It is not intended to be
instantiated as is (and it may indeed not be instantiable).  A good
example (I think) is a class I have called `lockable-object' which has
a very simple locking protocol associated with it, and which you can
then mix in to some other class:

	(defclass lockable-log-stream (log-stream lockable-mixin)
	  ())

to create a log-stream that has locking.

The idea is that you have a whole load of these mixin classes which
can be mixed together with a `base class' to provide all sorts of
variants.  This works well with CLOS because you don't have to worry
about issues like inheriting more than once from the same class, which
I think you have to resolve yourself in C++.

A mixin server, if I understand what Jeff meant, is an object which
will provide, on demand, a class that mixes some set of superclasses.
If need be it will create the mixed class for you dynamically, and
then stash it and return the same class next time you ask for the same
mix.  Oaklisp had these things, and I suspect T before it?  They are
slightly hard to implement `right' in CL because you really to get at
the macro expansion of DEFCLASS, or use EVAL -- you can do it with any
reasonable CLOS MOP though.

The whole mixin terminology comes from flavors, and I think indirectly
from ice cream (never underestimate the influence of ice cream on
computing...).

--tim
From: Rolf-Thomas Happe
Subject: Re: A couple of doubts: boxing/unboxing, mixin
Date: 
Message-ID: <r5puwyiktg.fsf@bonnie.mathematik.uni-freiburg.de>
Tim Bradshaw:
> The whole mixin terminology comes from flavors, and I think indirectly
> from ice cream (never underestimate the influence of ice cream on
> computing...).

P. Norvig's _Paradigms_..._ briefly resumes the prehistory of CLOS, 
when flavors (vanilla, ...) and mixins (chocolate chips, ...) still
dwelt in Ted's (?) Ice Cream Parlour. 

rthappe
From: Chuck Fry
Subject: Re: A couple of doubts: boxing/unboxing, mixin
Date: 
Message-ID: <383d988c$0$212@nntp1.ba.best.com>
In article <··············@bonnie.mathematik.uni-freiburg.de>,
Rolf-Thomas Happe  <·······@bonnie.mathematik.uni-freiburg.de> wrote:
>Tim Bradshaw:
>> The whole mixin terminology comes from flavors, and I think indirectly
>> from ice cream (never underestimate the influence of ice cream on
>> computing...).
>
>P. Norvig's _Paradigms_..._ briefly resumes the prehistory of CLOS, 
>when flavors (vanilla, ...) and mixins (chocolate chips, ...) still
>dwelt in Ted's (?) Ice Cream Parlour. 

In the MIT tradition, the name "mixins" comes from Emac & Bolio's ice
cream parlor in Cambridge, Mass.  (Flavors, one of the earliest Lisp OO
extensions to support multiple inheritance, came from MIT.)

 -- Chuck, never at MIT

--
	    Chuck Fry -- Jack of all trades, master of none
 ······@chucko.com (text only please)  ········@home.com (MIME enabled)
Lisp bigot, car nut, photographer, sometime guitarist and mountain biker
The addresses above are real.  All spammers will be reported to their ISPs.
From: Christopher C Stacy
Subject: Re: A couple of doubts: boxing/unboxing, mixin
Date: 
Message-ID: <x8lemdcwewj.fsf@world.std.com>
"...and Im not going to tell you about the text justifier, either!"