From: Gilbert Baumann
Subject: CLIM:WITH-LOCAL-COORDINATES puzzle
Date: 
Message-ID: <878ysrjico.fsf@saphir.local>
Hi, there.

I was just about to implement the WITH-LOCAL-COORDINATES [1] for
McCLIM. The write up in the specification always seemed a bit vague to
me. So with help from #lisp we took a peek at the macro expansion of
it in a "real" CLIM.

There seems to be a disagreement between the implementation and the
specification. While the specification says that the default values
for X/Y are (0,0) the implementation uses the cursor position of the
stream. Which would also imply that this macro can only be used for
streams [unless X and Y are explicitly given] and not on "bare" media
although the corresponding macro parameter is called "medium".

So I am stuck now and would be grateful for any input upon whether the
specification states the correct intend and the implementation is
faulty or perhaps a leftover from CLIM-1 or DW. Or whether the
write-up of the specification misses something.

[1] <http://www.stud.uni-karlsruhe.de/~unk6/clim-spec/10-2.html#Z23>

-- 
Gilbert Baumann
;; Will hack for food.

From: Kent M Pitman
Subject: Re: CLIM:WITH-LOCAL-COORDINATES puzzle
Date: 
Message-ID: <sfwvfvvb1eh.fsf@shell01.TheWorld.com>
Gilbert Baumann <····@rz.uni-karlsruhe.de> writes:

> I was just about to implement the WITH-LOCAL-COORDINATES [1] for
> McCLIM. The write up in the specification always seemed a bit vague to
> me. So with help from #lisp we took a peek at the macro expansion of
> it in a "real" CLIM.
> 
> There seems to be a disagreement between the implementation and the
> specification. While the specification says that the default values
> for X/Y are (0,0) the implementation uses the cursor position of the
> stream. 

I couldn't figure out if the next "Which" in your text applies to the 
former case, the latter case, or the fact of the confusion.

> Which would also imply that this macro can only be used for
> streams [unless X and Y are explicitly given] and not on "bare" media
> although the corresponding macro parameter is called "medium".

I'll be interested to see if Scott McKay responds on this from the
implementor/designer's point of view.

I have a vague recollection of an operator (probably this one) causing
a problem in my learning about it.  I seem to recall using it and
wondering "where did my output go" and finding that it was drawing it
on the first screenful of the lisp listener rather than inserting it
at the cursor as I might expect.  Having it be dead reckoned is not
really a useful default, so I think that if there is any notion of
cursor or stream position, that's the better place to have it default
to from a design standpoint.

I just looked at the spec at the URL you cited and I don't really see any
ambiguity.  My first inclination is to say that yes, the x=0,y=0 defaults
are just chosen badly, or perhaps are chosen this way because not every
medium has a cursor and maybe its effect would be perceived as ill-defined
otherwise.  But as I think of it, here's the problem case:

Suppose I write a subroutine draw-frob that takes a medium and uses this
operator.  Now suppose I apply it to a medium with a cursor and get one
effect, and to a medium without a cursor and get a different effect.  
By making the default be 0,0 in both cases, you force the operations that
determine the cursor to be explicit, and hopefully you force an error on
media that have no cursor because it becomes apparent that you can't 
succeed otherwise.  I think if you're going to default to the current cursor
position, that could be reasonable, but you should err (rather than draw
the wrong thing) if you have a medium without a cursor.

In any case, I think you should write some sample code to test the behavior
and get the CLIM designers to all agree on a behavior.  Perhaps you should
make a clim-designers mailing list for doing consensus resolution of these
things.

> So I am stuck now and would be grateful for any input upon whether the
> specification states the correct intend and the implementation is
> faulty or perhaps a leftover from CLIM-1 or DW. Or whether the
> write-up of the specification misses something.
> 
> [1] <http://www.stud.uni-karlsruhe.de/~unk6/clim-spec/10-2.html#Z23>
From: Scott McKay
Subject: Re: CLIM:WITH-LOCAL-COORDINATES puzzle
Date: 
Message-ID: <c7eBa.1026520$F1.123155@sccrnsc04>
"Kent M Pitman" <······@world.std.com> wrote in message
····················@shell01.TheWorld.com...
> Gilbert Baumann <····@rz.uni-karlsruhe.de> writes:
>

> I just looked at the spec at the URL you cited and I don't really see any
> ambiguity.  My first inclination is to say that yes, the x=0,y=0 defaults
> are just chosen badly, or perhaps are chosen this way because not every
> medium has a cursor and maybe its effect would be perceived as ill-defined
> otherwise.  But as I think of it, here's the problem case:
>

CLIM got the "bootstrapping" of output recording wrong,
and attempts to correct everything by constantly referring
to the X/Y cursor.  This was a big mistake, but I don't think
I realized it until way too late.

It's probably no consolation that I got it right in the output
recording module for DUIM....
From: Arthur Lemmens
Subject: Re: CLIM:WITH-LOCAL-COORDINATES puzzle
Date: 
Message-ID: <3ED52C87.F1912D5@xs4all.nl>
Gilbert Baumann wrote:

> There seems to be a disagreement between the implementation and the
> specification. 

It's probably not the only one. In cases like that, I usually check the
CLIM documentation from Franz; it's usually more accurate than the 
specification, and it has some nice examples as well. I get the impression
that they used the CLIM 2.0 specification as the base for their 
own documentation, but spent a lot of time on improving it.

Here's what Franz' doc says (p. 74) about WITH-LOCAL-COORDINATES:

  WITH-LOCAL-COORDINATES  [Macro]

  Arguments: (&optional stream x y) &body body

  Binds the dynamic environment to establish a local coordinate system
  with the positive X-axis extending to the right and the positive Y-axis 
  extending downward, with (0,0) at (x,y). If x and y are not specified 
  (or even if x is and y is not), the current cursor position of stream is
  used as (0,0).

There's also a nice picture of an arrow drawn using

  (with-local-coordinates (*test-pane* 200 200) 
     (draw-arrow* 0 0 50 50))

but you'll have to look that one up yourself.

My suggestion would be to follow the implementation and Franz' 
documentation instead of blindly following a specification that seems 
to have never been really finished.

Regards,

Arthur Lemmens
From: Scott McKay
Subject: Re: CLIM:WITH-LOCAL-COORDINATES puzzle
Date: 
Message-ID: <d5eBa.1026501$F1.123253@sccrnsc04>
"Arthur Lemmens" <········@xs4all.nl> wrote in message
·····················@xs4all.nl...
>
> Gilbert Baumann wrote:
>
> > There seems to be a disagreement between the implementation and the
> > specification.

I don't have a spec in front of me, but the Franz doc (which I
wrote originally) looks correct to me.

It is true that when I wrote the "raw" Franz doc, I started with
the CLIM spec and some material from internal Symbolics
documents, and tried to "do it right".  I'll bet none of my
corrections got back into the CLIM 2.0 spec, though.

> It's probably not the only one. In cases like that, I usually check the
> CLIM documentation from Franz; it's usually more accurate than the
> specification, and it has some nice examples as well. I get the impression
> that they used the CLIM 2.0 specification as the base for their
> own documentation, but spent a lot of time on improving it.
>
> Here's what Franz' doc says (p. 74) about WITH-LOCAL-COORDINATES:
>
>   WITH-LOCAL-COORDINATES  [Macro]
>
>   Arguments: (&optional stream x y) &body body
>
>   Binds the dynamic environment to establish a local coordinate system
>   with the positive X-axis extending to the right and the positive Y-axis
>   extending downward, with (0,0) at (x,y). If x and y are not specified
>   (or even if x is and y is not), the current cursor position of stream is
>   used as (0,0).
>
> There's also a nice picture of an arrow drawn using
>
>   (with-local-coordinates (*test-pane* 200 200)
>      (draw-arrow* 0 0 50 50))
>
> but you'll have to look that one up yourself.
>
> My suggestion would be to follow the implementation and Franz'
> documentation instead of blindly following a specification that seems
> to have never been really finished.
>
From: Gilbert Baumann
Subject: Re: CLIM:WITH-LOCAL-COORDINATES puzzle
Date: 
Message-ID: <874r3ejvgw.fsf@saphir.local>
Arthur Lemmens <········@xs4all.nl> writes:
> Gilbert Baumann wrote:
> 
> > There seems to be a disagreement between the implementation and the
> > specification. 
> 
> Here's what Franz' doc says (p. 74) about WITH-LOCAL-COORDINATES:
> 
>   WITH-LOCAL-COORDINATES  [Macro]
> 
>   Arguments: (&optional stream x y) &body body
> 
>   Binds the dynamic environment to establish a local coordinate system
>   with the positive X-axis extending to the right and the positive Y-axis 
>   extending downward, with (0,0) at (x,y). If x and y are not specified 
>   (or even if x is and y is not), the current cursor position of stream is
>   used as (0,0).

This is not in disagreement with our version of the specification of
which I gave an URL to. (Modulo making stream optional and documenting
odd behavior in case only one of the coordinates is given).

> My suggestion would be to follow the implementation and Franz' 
> documentation instead of blindly following a specification that seems 
> to have never been really finished.

I'd like to do that but I can't as my original posting pointed out:
The specification and the implementation disagree. The implementation
defaults X and Y to the cursor position while the specification
defaults them to (0,0).

-- 
Gilbert Baumann
;; Will hack for food.
From: Rainer Joswig
Subject: Re: CLIM:WITH-LOCAL-COORDINATES puzzle
Date: 
Message-ID: <c366f098.0305290317.381b206b@posting.google.com>
Gilbert Baumann <····@rz.uni-karlsruhe.de> wrote in message news:<··············@saphir.local>...
> Arthur Lemmens <········@xs4all.nl> writes:
> > Gilbert Baumann wrote:
> > 
> > > There seems to be a disagreement between the implementation and the
> > > specification. 
> > 
> > Here's what Franz' doc says (p. 74) about WITH-LOCAL-COORDINATES:
> > 
> >   WITH-LOCAL-COORDINATES  [Macro]
> > 
> >   Arguments: (&optional stream x y) &body body
> > 
> >   Binds the dynamic environment to establish a local coordinate system
> >   with the positive X-axis extending to the right and the positive Y-axis 
> >   extending downward, with (0,0) at (x,y). If x and y are not specified 
> >   (or even if x is and y is not), the current cursor position of stream is
> >   used as (0,0).
> 
> This is not in disagreement with our version of the specification of
> which I gave an URL to. (Modulo making stream optional and documenting
> odd behavior in case only one of the coordinates is given).
> 
> > My suggestion would be to follow the implementation and Franz' 
> > documentation instead of blindly following a specification that seems 
> > to have never been really finished.
> 
> I'd like to do that but I can't as my original posting pointed out:
> The specification and the implementation disagree. The implementation
> defaults X and Y to the cursor position while the specification
> defaults them to (0,0).

The Symbolics documentation talks also about the current cursor position.
Sounds useful...
From: Arthur Lemmens
Subject: Re: CLIM:WITH-LOCAL-COORDINATES puzzle
Date: 
Message-ID: <3ED5BA84.66BC8ABE@xs4all.nl>
Gilbert Baumann wrote:
> 
> Arthur Lemmens <········@xs4all.nl> writes:
> >
> >   Binds the dynamic environment to establish a local coordinate system
> >   with the positive X-axis extending to the right and the positive Y-axis
> >   extending downward, with (0,0) at (x,y). If x and y are not specified
> >   (or even if x is and y is not), the current cursor position of stream is
> >   used as (0,0).
> 
> This is not in disagreement with our version of the specification of
> which I gave an URL to.

I think it IS in disagreement. When Franz says "the current cursor position
of stream is used as (0,0)", I think this means that the current cursor
position is to be the origin of the new local coordinate system.

The spec says "x and y [...] default to 0". I think this means that the
origin of the new local coordinate system defaults to point (0,0) of the
stream (in the old coordinate system). In other words, the spec says that
the new coordinate system defaults to the old one. Franz says that the 
new coordinate system defaults to one with the origin at the current
cursor position.

Arthur Lemmens
From: Gilbert Baumann
Subject: Re: CLIM:WITH-LOCAL-COORDINATES puzzle
Date: 
Message-ID: <87y90pj23y.fsf@saphir.local>
Arthur Lemmens <········@xs4all.nl> writes:
> Gilbert Baumann wrote:
> > 
> > Arthur Lemmens <········@xs4all.nl> writes:
> > >
> > >   Binds the dynamic environment to establish a local coordinate system
> > >   with the positive X-axis extending to the right and the positive Y-axis
> > >   extending downward, with (0,0) at (x,y). If x and y are not specified
> > >   (or even if x is and y is not), the current cursor position of stream is
> > >   used as (0,0).
> > 
> > This is not in disagreement with our version of the specification of
> > which I gave an URL to.
> 
> I think it IS in disagreement. When Franz says "the current cursor position
> of stream is used as (0,0)", I think this means that the current cursor
> position is to be the origin of the new local coordinate system.

Oops, you are right, I misread. Note to myself: Don't post too late at
night.

-- 
Gilbert Baumann
;; Will hack for food.