Eduardo Cavazos | 29 Aug 22:45

Help article for clipboard protocol

Slava,

The "clipboard-protocol" help article mentions the old 
accessors 'clipboard-contents' and 'set-clipboard-contents' directly. My 
guess is that I can mention the 'contents>>' method/accessor instead. But 
what about the setter? Should I mention the '(>>contents)' generic? It 
doesn't seem right to give instructions to override '>>contents' since it's 
not a generic. On the other hand, I thought the '(>>contents)' style setters 
were considered sort of "behind the scenes". Perhaps for a case like this 
where you're extending the protocol, it makes sense to talk about this sort 
of behind the scenes stuff.

Ed

-------------------------------------------------------------------------
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=/
Slava Pestov | 29 Aug 23:34

Re: Help article for clipboard protocol

Hi Ed,

This is tricky because some of the UI backends define methods on the old accessors, eg Cocoa:

TUPLE: pasteboard handle ;

C: <pasteboard> pasteboard

M: pasteboard clipboard-contents
    pasteboard-handle pasteboard-string ;

M: pasteboard set-clipboard-contents
    pasteboard-handle set-pasteboard-string ;

I think the right approach here is to add a pair of generic words,

GENERIC: clipboard-contents ( clipboard -- string )
GENERIC: set-clipboard-contents ( string clipboard -- )

And two methods for the default implementation,

M: clipboard clipboard-contents contents>> ;
M: clipboard set-clipboard-contents (>>contents) ;

Be on the lookout for accessors which have other methods defined on them. I'd rather these accessors remained with the 'old style' names, and had methods to read/write the slot defined on them as above, rather than the Cocoa UI backend placing methods on contents>> and (>>contents).

The help system is the same; there's an article tuple with a contents slot, but a few different data types have methods on article-contents.

So in general, you can only replace foo-bar with bar>> if \ foo-bar see-methods shows no other methods.

Slava

On Fri, Aug 29, 2008 at 3:46 PM, Eduardo Cavazos <wayo.cavazos-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
Slava,

The "clipboard-protocol" help article mentions the old
accessors 'clipboard-contents' and 'set-clipboard-contents' directly. My
guess is that I can mention the 'contents>>' method/accessor instead. But
what about the setter? Should I mention the '(>>contents)' generic? It
doesn't seem right to give instructions to override '>>contents' since it's
not a generic. On the other hand, I thought the '(>>contents)' style setters
were considered sort of "behind the scenes". Perhaps for a case like this
where you're extending the protocol, it makes sense to talk about this sort
of behind the scenes stuff.

Ed

-------------------------------------------------------------------------
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=/
_______________________________________________
Factor-talk mailing list
Factor-talk-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/factor-talk

-------------------------------------------------------------------------
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=/
_______________________________________________
Factor-talk mailing list
Factor-talk@...
https://lists.sourceforge.net/lists/listinfo/factor-talk
Eduardo Cavazos | 30 Aug 01:32

Generics for 'clipboard-contents' and 'set-clipboard-contents'

On Friday 29 August 2008 16:34:38 Slava Pestov wrote:

> I think the right approach here is to add a pair of generic words,
>
> GENERIC: clipboard-contents ( clipboard -- string )
> GENERIC: set-clipboard-contents ( string clipboard -- )
>
> And two methods for the default implementation,
>
> M: clipboard clipboard-contents contents>> ;
> M: clipboard set-clipboard-contents (>>contents) ;

Okiedokie.

However, those two are already generics because of the tuple definition 
itself:

	TUPLE: clipboard contents ;

When you update the tuple code so that the old accessor generics are no longer 
generated, the above will make sense. So, were you suggesting that I install 
the 'GENERIC:' statements in the 'ui.clipboards' vocabulary now? Or do I 
leave it as is till the accessors actually go away?

Perhaps at this point I should only add the methods which link to the new 
accessors:

	M: clipboard clipboard-contents contents>> ;
	M: clipboard set-clipboard-contents (>>contents) ;

Ed

-------------------------------------------------------------------------
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=/
Slava Pestov | 30 Aug 01:37

Re: Generics for 'clipboard-contents' and 'set-clipboard-contents'

Hi Ed,

The following code should work without problems in any order of definition:

TUPLE: foo bar ;

GENERIC: foo-bar

The redundant (for now) generic definition will not cause any problems.

Slava

On Fri, Aug 29, 2008 at 6:32 PM, Eduardo Cavazos <wayo.cavazos-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
On Friday 29 August 2008 16:34:38 Slava Pestov wrote:

> I think the right approach here is to add a pair of generic words,
>
> GENERIC: clipboard-contents ( clipboard -- string )
> GENERIC: set-clipboard-contents ( string clipboard -- )
>
> And two methods for the default implementation,
>
> M: clipboard clipboard-contents contents>> ;
> M: clipboard set-clipboard-contents (>>contents) ;

Okiedokie.

However, those two are already generics because of the tuple definition
itself:

       TUPLE: clipboard contents ;

When you update the tuple code so that the old accessor generics are no longer
generated, the above will make sense. So, were you suggesting that I install
the 'GENERIC:' statements in the 'ui.clipboards' vocabulary now? Or do I
leave it as is till the accessors actually go away?

Perhaps at this point I should only add the methods which link to the new
accessors:

       M: clipboard clipboard-contents contents>> ;
       M: clipboard set-clipboard-contents (>>contents) ;

Ed

-------------------------------------------------------------------------
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=/
_______________________________________________
Factor-talk mailing list
Factor-talk-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/factor-talk

-------------------------------------------------------------------------
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=/
_______________________________________________
Factor-talk mailing list
Factor-talk@...
https://lists.sourceforge.net/lists/listinfo/factor-talk

Gmane