Blake McBride | 1 Aug 03:26 2008

No CLOS :metaclass option support


Running the code:


(defclass meta-class1 (standard-class)
  (cv1 cv2 cv3)
  (:metaclass standard-class))

(defclass class1 (standard-object)
  (iv1 iv2 iv3)
  (:metaclass meta-class1))

The second object returns:

#<STANDARD-CLASS CLASS1 {F673CC}>

It should be:

#<META-CLASS1 CLASS1 {F673CC}>

Not only is it reporting the wrong class of class1 but it doesn't work either.  I suppose ABCL doesn't support the :metaclass option.  It just ignores it.  The problem is that without that option ABCL's CLOS is severely limited.  Any plans to fix this?

Thanks.

Blake McBride

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
armedbear-j-devel mailing list
armedbear-j-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/armedbear-j-devel
Erik Huelsmann | 4 Aug 10:03 2008
Picon

[PATCH (preparation)] Reader and #n# interaction

ABCL allows me to create a form (using *PRINT-CIRCLE*) which it can't
read back in because of the #n# in the structure. I've attached a
small reproduction recipe below.

The program below currently generates an error (something along the
lines of "There's no binding for #1#"). Fixing the program below is
easy: there are two calls to Stream.read(), one in readStructure and
one in faslReadStructure respectively. These calls both need the
:recursive parameter of 'true' (instead of the current 'false').

Before I prepare a patch however, I'd like to know if it wouldn't be
better to have all calls to readDelimitedList(), read(), etc. in
Stream.java take the :recursive 'true' parameter. Currently, as far as
I could see, this was not the case (but I might have missed some).

So: should I provide a patch just to solve the issue below, or should
I scan the file and change the recursive parameter everywhere - where
applicable.

=========================
(defparameter q "some string")

(defstruct s slot)

(let ((*print-circle* t))
(read-from-string
        (print (prin1-to-string (list (make-s :slot q)
                               (make-s :slot q))))))
;; output of the PRINT form:
;; (#S(S :SLOT #1="some string") #S(S :SLOT #1#))

=========================

Bye,

Erik.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
Erik Huelsmann | 4 Aug 11:19 2008
Picon

Re: [Fwd: Embedding ABCL in a Java Program: Exceptions]

On 11/11/07, Ville Voutilainen <ville.voutilainen <at> gmail.com> wrote:
> I *finally* got some time to test the following scenario:
>
> 1) invoke java code from lisp (as usual)
> 2) lisp code invokes java code
> 3) java code invoked in 2) throws an exception
>
> This is handled by abcl so that the java exception thrown in 3) raises
> a condition
> of type java-exception, which can be handled in lisp code with usual
> handler-case.
> I decided I like this approach, because although it is not transparent, it means
> that abcl code is not that tied to java. If we would have only
> lisp->java integration,

If you're not afraid to code to the internals of ABCL (they're not
that fast moving), I have a function called "safeFuncall" which
catches any uncaught conditions and raises them as Java exceptions of
type "ConditionThrowable".

> we could not assume that there is a java code layer invoking the lisp code.
> Therefore it's reasonable to let the lisp code handle the condition, instead
> of letting the java exception travel through. As discussed before, it's further
> possible to map the condition to a ConditionThrowable at the java code
> that is run at step 1).

Exactly. Want to have the code? Or maybe I should suggest adding this
code to the LispObject implementation?

Bye,

Erik.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
Erik Huelsmann | 4 Aug 11:41 2008
Picon

Re: bug: adjustable arrays are not adjustable

Has this issue been addressed in the mean time?

Bye,

Erik.

On 2/18/08, Alex Mizrahi <killerstorm <at> newmail.ru> wrote:
> if multidimensional array is created as non-adjustable, it can be adjusted
> (new array is created).
>
> if multidimensional array is created as adjustable, it cannot be adjusted:
> adjust-array signals "ADJUST-ARRAY: unsupported case." error.
>
> for one dimensional array (vector) all is well.
>
> while i understand that this is probably just feature missing, this appears
> to be weird: if you want array to become adjustable, it becomes not.
>
>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> armedbear-j-devel mailing list
> armedbear-j-devel <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/armedbear-j-devel
>

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
Ville Voutilainen | 4 Aug 12:27 2008
Picon

Re: [Fwd: Embedding ABCL in a Java Program: Exceptions]

> If you're not afraid to code to the internals of ABCL (they're not
> that fast moving), I have a function called "safeFuncall" which
> catches any uncaught conditions and raises them as Java exceptions of
> type "ConditionThrowable".

Sounds interesting. Is this code in ABCL cvs or just something
external you implemented?

> Exactly. Want to have the code? Or maybe I should suggest adding this
> code to the LispObject implementation?

Yes, if you can post the code I'd be interested in looking at it and probably
using it, too. The idea of adding it to LispObject sounds good too, since
some people use LispObject for invoking lisp code. I am personally more
inclined to use Interpreter, since I deal with code that has quite a bit
of macros. Anyway, having LispObject throw java-exceptions on uncaught
conditions is IMHO very useful. I wouldn't modify Interpreter to do the
same, though.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
Erik Huelsmann | 4 Aug 14:48 2008
Picon

Re: [Fwd: Embedding ABCL in a Java Program: Exceptions]

On 8/4/08, Ville Voutilainen <ville.voutilainen <at> gmail.com> wrote:
> > If you're not afraid to code to the internals of ABCL (they're not
> > that fast moving), I have a function called "safeFuncall" which
> > catches any uncaught conditions and raises them as Java exceptions of
> > type "ConditionThrowable".
>
> Sounds interesting. Is this code in ABCL cvs or just something
> external you implemented?

It's external.

> > Exactly. Want to have the code? Or maybe I should suggest adding this
> > code to the LispObject implementation?
>
> Yes, if you can post the code I'd be interested in looking at it and probably
> using it, too. The idea of adding it to LispObject sounds good too, since
> some people use LispObject for invoking lisp code. I am personally more
> inclined to use Interpreter, since I deal with code that has quite a bit
> of macros. Anyway, having LispObject throw java-exceptions on uncaught
> conditions is IMHO very useful. I wouldn't modify Interpreter to do the
> same, though.

It's not possible to change the behaviour of the interpreter, but you
could wrap the interpreter's eval() to be safeEval() with the same
trick that I did with safeFuncall().

I have an extreme amount of function calls into lisp to achieve what I
need to do, but I don't work with macro's a lot, however, doing it my
way doesn't mean "no macros", it simply means you can't call code
which is defined by a macro (ie I call DEFUNs).

I'll post the code I have this evening (CET).

Bye,

Erik.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
Ville Voutilainen | 4 Aug 17:18 2008
Picon

Re: [Fwd: Embedding ABCL in a Java Program: Exceptions]

>> conditions is IMHO very useful. I wouldn't modify Interpreter to do the
>> same, though.
> It's not possible to change the behaviour of the interpreter, but you
> could wrap the interpreter's eval() to be safeEval() with the same
> trick that I did with safeFuncall().

I personally neither need nor want this wrapping by default. I'd like
to have it as an option, meaning that maybe the safeEval could
be exposed on the Java side for people who want that functionality.

I usually try to keep my lisp code portable - that means handling
conditions properly in lisp code and never depending on abcl to
map unhandled conditions. That way I can run the same lisp
code in environments where abcl is not present. Other people
may want more automation and java integration.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
Erik Huelsmann | 4 Aug 20:55 2008
Picon

[PATCH] Fix #n# replacement with structures

Ok, I've finished analyzing Stream.java and I've come to the
conclusion the patch below should be enough to fix all reader errors
regarding #n# replacement.

The patch below fixes the is program, meaning that -instead of raising
an error- it happily reads its own output back in.

Bye,

Erik.

======================================

(defparameter q "some string")

(defstruct s slot)

(let ((*print-circle* t))
(read-from-string
        (print (prin1-to-string (list (make-s :slot q)
                               (make-s :slot q))))))

======================================

Index: Stream.java
===================================================================
RCS file: /cvsroot/armedbear-j/j/j/src/org/armedbear/lisp/Stream.java,v
retrieving revision 1.154
diff -u -r1.154 Stream.java
--- Stream.java	23 Feb 2007 21:17:34 -0000	1.154
+++ Stream.java	4 Aug 2008 18:09:16 -0000
 <at>  <at>  -424,7 +424,7  <at>  <at> 
   public LispObject readStructure() throws ConditionThrowable
   {
     final LispThread thread = LispThread.currentThread();
-    LispObject obj = read(true, NIL, false, thread);
+    LispObject obj = read(true, NIL, true, thread);
     if (Symbol.READ_SUPPRESS.symbolValue(thread) != NIL)
       return NIL;
     if (obj.listp())
 <at>  <at>  -472,7 +472,7  <at>  <at> 
   public LispObject faslReadStructure() throws ConditionThrowable
   {
     final LispThread thread = LispThread.currentThread();
-    LispObject obj = faslRead(true, NIL, false, thread);
+    LispObject obj = faslRead(true, NIL, true, thread);
     if (Symbol.READ_SUPPRESS.symbolValue(thread) != NIL)
       return NIL;
     if (obj.listp())
Attachment (Stream.java.patch): application/octet-stream, 1414 bytes
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
armedbear-j-devel mailing list
armedbear-j-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/armedbear-j-devel
Erik Huelsmann | 4 Aug 21:26 2008
Picon

[PATCH] Don't do unnecessary work: clrhash on empty hash

The attached patch doesn't do much for the build-time of ABCL (not as
much as the 10% when the equivalent patch went into SBCL), but it's
still nice not to do too much work.

Bye,

Erik.

Index: HashTable.java
===================================================================
RCS file: /cvsroot/armedbear-j/j/j/src/org/armedbear/lisp/HashTable.java,v
retrieving revision 1.57
diff -u -r1.57 HashTable.java
--- HashTable.java	6 Mar 2007 11:40:49 -0000	1.57
+++ HashTable.java	4 Aug 2008 19:20:09 -0000
 <at>  <at>  -150,6 +150,8  <at>  <at> 

   public synchronized void clear()
   {
+    if (count == 0) return;
+
     for (int i = buckets.length; i-- > 0;)
       buckets[i] = null;
     count = 0;

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
Erik Huelsmann | 4 Aug 21:33 2008
Picon

Re: [Fwd: Embedding ABCL in a Java Program: Exceptions]

On Mon, Aug 4, 2008 at 12:27 PM, Ville Voutilainen
<ville.voutilainen <at> gmail.com> wrote:
>> If you're not afraid to code to the internals of ABCL (they're not
>> that fast moving), I have a function called "safeFuncall" which
>> catches any uncaught conditions and raises them as Java exceptions of
>> type "ConditionThrowable".
>
> Sounds interesting. Is this code in ABCL cvs or just something
> external you implemented?
>
>> Exactly. Want to have the code? Or maybe I should suggest adding this
>> code to the LispObject implementation?
>
> Yes, if you can post the code I'd be interested in looking at it and probably
> using it, too. The idea of adding it to LispObject sounds good too, since
> some people use LispObject for invoking lisp code. I am personally more
> inclined to use Interpreter, since I deal with code that has quite a bit
> of macros. Anyway, having LispObject throw java-exceptions on uncaught
> conditions is IMHO very useful. I wouldn't modify Interpreter to do the
> same, though.
>

The code is below, I find it a bit of a mess now that I look at it
again, but the general concept should be clear.

HTH,

Erik.

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package extendedlisp;

import org.armedbear.lisp.*;
import org.armedbear.lisp.Package;
import java.lang.Runnable;

/**
 *
 *  <at> author Erik
 */
public class ExtendedLisp extends Lisp {
    final static Symbol _HANDLER_CLUSTERS_ =
            PACKAGE_SYS.intern("*HANDLER-CLUSTERS*");
    final static Symbol ERROR =
            PACKAGE_CL.intern("ERROR");

    public static class IgnoreHandler extends Function {
        final Symbol tag;

        public IgnoreHandler(Symbol aTag) {
            super();

            tag = aTag;
        }

         <at> Override
        public LispObject execute(LispObject arg)
                throws ConditionThrowable
        {
            throw new Go(tag);
        }
    }

    public static class ConverterHandler extends Function {
        public ConverterHandler() { };

         <at> Override
        public LispObject execute(LispObject arg)
                throws ConditionThrowable {
            throw LispErrorMap.getError(arg);
        }
    }

    public static LispObject createHandlers()
            throws ConditionThrowable {
        return NIL;
    }

    public static LispObject addToHandlers(LispObject cluster, Symbol
type, LispObject handler)
            throws ConditionThrowable {
        return new Cons( new Cons(type, handler), cluster);
    }

    public static void bindHandlers(LispObject cluster)
            throws ConditionThrowable {
        LispObject cval = _HANDLER_CLUSTERS_.symbolValue();
        if (cval == null)
            cval = NIL;

        LispThread.currentThread().bindSpecial(_HANDLER_CLUSTERS_,
                    new Cons(cluster, cval));
    }

    public static void unbindHandlers()
            throws ConditionThrowable {
        LispThread.currentThread().rebindSpecial(_HANDLER_CLUSTERS_,
                _HANDLER_CLUSTERS_.symbolValue().cdr());
    }

    public static LispObject funcall_without_errors(LispObject fun,
LispObject[] args, LispThread thread)
            throws ConditionThrowable
    {
        bindHandlers(addToHandlers(createHandlers(),
                ERROR, new IgnoreHandler(T))); // we don't care about
the symbol here

        try {
            return funcall(fun, args, thread);
        }
        catch (ConditionThrowable ct) { return null; }
        finally {
            unbindHandlers();
        }
    }

    public static LispObject funcall_with_conversion(LispObject fun,
LispObject[] args, LispThread thread)
            throws ConditionThrowable {
        bindHandlers(addToHandlers(createHandlers(),
                ERROR, new ConverterHandler()));

        try {
            return funcall(fun, args, thread);
        }
        finally {
            unbindHandlers();
        }
    }

    public static void ignoreErrors(Runnable R)
            throws ConditionThrowable
    {
        bindHandlers(addToHandlers(createHandlers(),
                ERROR, new IgnoreHandler(T)));

        try {
            R.run();
        }
        finally {
            unbindHandlers();
        }
    }

}

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

Gmane