Lisp HUG Maillist Archive

LWM and LWW

Hello,

We started to port our software from LWM to LWW. For the most part 
this work has advanced very well.
We have, however,  encountered some problems in LWW:


(1) in LWW we get  an error if we call 'apply' with a list who's 
length is greater than 255,
Is there a way to specify the length of the argument list for 'apply' 
(LWM seems to be
more tolerant when calling 'apply').

(2) whan a capi window is selected with a click in the window area, 
it receives extra events (click.-down,  click-motion, and 
click-release or for input-models: (:button-1  :press) (:button-1 
:motion) (:button-1  :release)).  In LWM the window is only selected. 
Is there a way to avoid these
extra events in LWW ?

Mikael


Re: LWM and LWW

Unable to parse email body. Email id is 2840

Re: LWM and LWW

>
>  > (2) whan a capi window is selected with a click in the window area,
>  > it receives extra events (click.-down,  click-motion, and
>  > click-release or for input-models: (:button-1  :press) (:button-1
>  > :motion) (:button-1  :release)).  In LWM the window is only selected.
>  > Is there a way to avoid these
>  > extra events in LWW ?
>
>I'm not sure what you mean by extra events. Do you have some example
>code illustrating the issue?
>
>--
>Dave Fox

Here is a simple test:

(capi:define-interface test ()
   ()
   (:panes (opengl capi:opengl-pane
                   :input-model
                   '(((:button-1  :press)  testl-button1-press)
                     ((:button-1  :motion) test-button1-press-motion)
                     ((:button-1  :release) test-button1-release)))))

(defmethod testl-button1-press (&rest args)
   (print 'press))
(defmethod test-button1-press-motion (&rest args)
   (print 'motion))
(defmethod test-button1-release (&rest args)
   (print 'release))

(capi:find-interface 'test)

If I select in LWM the window by clicking in the opengl-pane area, 
there are no prints, as the first
click is used only to select the window. After this any further 
clicks in the opengl-pane area
are printed as expected.

If the same operation is carried out in LWW (i.e. a selection click 
in the  in opengl-pane area), the window is selected AND I get all 3 
prints: 'press', 'motion' and 'release'.

We would prefer the LWM behaviour as here the selection click only 
selects the window and does not affect the
state of the window otherwise (like deselecting some objects, etc.).

(Just as a parenthesis: This behaviour seems also to be the case with 
the LWW text editor, as you do not loose a text selection, if you 
select the editor window with a click in the editing area.)

Mikael


Re: LWM and LWW

Mikael Laurson <laurson@siba.fi> writes:

> (1) in LWW we get  an error if we call 'apply' with a list who's
> length is greater than 255,

The limit in LW is very low, but why do you want to call apply on
that many arguments? 
-- 
  (espen)


Re: LWM and LWW

Espen Vestre wrote:

>Mikael Laurson <laurson@siba.fi> writes:
>
>>  (1) in LWW we get  an error if we call 'apply' with a list who's
>>  length is greater than 255,
>
>The limit in LW is very low, but why do you want to call apply on
>that many arguments?
>--
We have ported our code from MCL and for the most part the process has
been very smooth when dealing with Common Lisp and CLOS related code.

The limit is indeed much higher in MCL (at least 5000 elements, which is enough
for our purposes). We can of course rewrite our code but occasionally 
the 'apply'
function is very handy. For me the LW limit seems to be very low.

Mikael


Re: LWM and LWW

LW's backquote implementation (mis)uses apply, so you can't read certain 
backquoted expressions in LWW.  256 is a pretty low limit for backquote...


At 10/6/2004 04:36 AM, Espen Vestre wrote:
>Mikael Laurson <laurson@siba.fi> writes:
>
> > for our purposes). We can of course rewrite our code but occasionally
> > the 'apply'
> > function is very handy. For me the LW limit seems to be very low.
>
>Coming from MCL (and Allegro), I was disturbed too the first time I
>encountered this, but I think it actually has helped me write better
>code: E.g.  using (apply #'+ pretty-random-list-of-numbers) is bad
>style except maybe if the length of the number list has a very hard
>and very low length limit. For more or less random lists, it's much
>better to use (reduce #'+ pretty-random-list-of-numbers). Likewise,
>(reduce #'append ...) is better style than (apply #'append ...).
>
>The only case I can think of where the low call arg limit would be
>really disturbing, is a function that would take, say, 150 different
>keyword arguments (I haven't actually seen such functions :-)).
>--
>   (espen)


Re: LWM and LWW

Unable to parse email body. Email id is 2866

Re: LWM and LWW

>  > LW's backquote implementation (mis)uses apply, so you can't read certain
>  > backquoted expressions in LWW.
>
>Could you show us an example of that? I didn't know that the LispWorks
>backquote implementation uses (or misuses) APPLY.
>
>  >                               256 is a pretty low limit for backquote...
>
>
>  >
>  > At 10/6/2004 04:36 AM, Espen Vestre wrote:
>  > >Mikael Laurson <laurson@siba.fi> writes:
>  > >
>  > > > for our purposes). We can of course rewrite our code but occasionally
>  > > > the 'apply'
>  > > > function is very handy. For me the LW limit seems to be very low.
>  > >
>  > >Coming from MCL (and Allegro), I was disturbed too the first time I
>  > >encountered this, but I think it actually has helped me write better
>  > >code: E.g.  using (apply #'+ pretty-random-list-of-numbers) is bad
>  > >style except maybe if the length of the number list has a very hard
>  > >and very low length limit. For more or less random lists, it's much
>  > >better to use (reduce #'+ pretty-random-list-of-numbers). Likewise,
>  > >(reduce #'append ...) is better style than (apply #'append ...).
>  > >
>  > >The only case I can think of where the low call arg limit would be
>  > >really disturbing, is a function that would take, say, 150 different
>  > >keyword arguments (I haven't actually seen such functions :-)).
>
>Further, Chris Reisbeck has pointed out (in mail that did not reach
>the list) that the Common Lisp standard only guarantees 50 as the
>minimum for CALL-ARGUMENTS-LIMIT, so counting on anything more means
>you're writing non-portable code.
>
>Nonetheless we will investigate raising the value of
>CALL-ARGUMENTS-LIMIT for a future LispWorks release.
>
OK, thanks for this information. We should have no problems porting our code
using 'reduce', etc.

Mikael


Re: LWM and LWW

Mikael Laurson <laurson@siba.fi> writes:

> for our purposes). We can of course rewrite our code but occasionally
> the 'apply'
> function is very handy. For me the LW limit seems to be very low.

Coming from MCL (and Allegro), I was disturbed too the first time I
encountered this, but I think it actually has helped me write better
code: E.g.  using (apply #'+ pretty-random-list-of-numbers) is bad
style except maybe if the length of the number list has a very hard
and very low length limit. For more or less random lists, it's much
better to use (reduce #'+ pretty-random-list-of-numbers). Likewise,
(reduce #'append ...) is better style than (apply #'append ...).

The only case I can think of where the low call arg limit would be
really disturbing, is a function that would take, say, 150 different
keyword arguments (I haven't actually seen such functions :-)).
-- 
  (espen)


Updated at: 2020-12-10 08:55 UTC