unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* GLib GObject & Javadot Notation for scheme?
@ 2004-04-26 15:21 Linas Vepstas
  2004-04-26 18:36 ` Andreas Rottmann
  0 siblings, 1 reply; 7+ messages in thread
From: Linas Vepstas @ 2004-04-26 15:21 UTC (permalink / raw)



Hi,

I was reading about  JScheme and in particular 'javadot notation':

  http://jscheme.sourceforge.net/jscheme/doc/javadot.html

and I was wondering if anybody had done anything similar for 
GLib GObjects for guile?  The idea seems pretty slick ...

--linas

-- 
pub  1024D/01045933 2001-02-01 Linas Vepstas (Labas!) <linas@linas.org>
PGP Key fingerprint = 8305 2521 6000 0B5E 8984  3F54 64A9 9A82 0104 5933

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: GLib GObject & Javadot Notation for scheme?
  2004-04-26 15:21 GLib GObject & Javadot Notation for scheme? Linas Vepstas
@ 2004-04-26 18:36 ` Andreas Rottmann
  2004-04-26 19:29   ` Andreas Rottmann
                     ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Andreas Rottmann @ 2004-04-26 18:36 UTC (permalink / raw)
  Cc: gtk-devel-list

linas@linas.org (Linas Vepstas) writes:

> Hi,
>
> I was reading about  JScheme and in particular 'javadot notation':
>
>   http://jscheme.sourceforge.net/jscheme/doc/javadot.html
>
> and I was wondering if anybody had done anything similar for 
> GLib GObjects for guile?  The idea seems pretty slick ...
>
There is something even better: guile-gobject[0]. Just as an
appetizer:

(use-modules (gnome gtk))

(define (app)
  (let* ((window (make <gtk-window> #:type 'toplevel))
	 (button (make <gtk-button> #:label "Hello, World!")))

    ;; since window is a container, this generic maps onto the function
    ;; gtk-container-set-border-width
    (set-border-width window 10)

    ;; note that we can set the border width with a gobject property as
    ;; well:
    (gobject-set-property window 'border-width 15)

    ;; (gnome gobject generics), re-exported by (gnome gtk), defines a
    ;; generic `set' method for gobject-set-property, se we can also do
    ;; it like this:
    (set window 'border-width 20)

    ;; this is much less typing :-)
    (add window button)
    
    ;; see (gnome gobject generics) for a full list of gobject generic
    ;; functions
    (connect button 'clicked (lambda (b) (gtk-main-quit)))

    ;; generic functions for .defs apis are defined in the .defs files,
    ;; not manually
    (show-all window)

    (gtk-main)))

(app)

Cheers, Andy
-- 
Andreas Rottmann         | Rotty@ICQ      | 118634484@ICQ | a.rottmann@gmx.at
http://yi.org/rotty      | GnuPG Key: http://yi.org/rotty/gpg.asc
Fingerprint              | DFB4 4EB4 78A4 5EEE 6219  F228 F92F CFC5 01FD 5B62

The best way to accelerate a Windows machine is at 9.81 m/s^2



_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: GLib GObject & Javadot Notation for scheme?
  2004-04-26 18:36 ` Andreas Rottmann
@ 2004-04-26 19:29   ` Andreas Rottmann
  2004-04-26 20:24   ` Paul Jarc
  2004-04-26 22:49   ` Daniel Skarda
  2 siblings, 0 replies; 7+ messages in thread
From: Andreas Rottmann @ 2004-04-26 19:29 UTC (permalink / raw)
  Cc: gtk-devel-list

Andreas Rottmann <a.rottmann@gmx.at> writes:

> There is something even better: guile-gobject[0]. 
>
I forgot the URL: http://www.gnu.org/software/guile-gtk/docs/guile-gobject/.

Also note that the GLib/GObject part of guile-gobject will be broken
out for separate use (expect tarballs soonish).

Andy
-- 
Andreas Rottmann         | Rotty@ICQ      | 118634484@ICQ | a.rottmann@gmx.at
http://yi.org/rotty      | GnuPG Key: http://yi.org/rotty/gpg.asc
Fingerprint              | DFB4 4EB4 78A4 5EEE 6219  F228 F92F CFC5 01FD 5B62

Python is executable pseudocode, Perl is executable line-noise.



_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: GLib GObject & Javadot Notation for scheme?
  2004-04-26 18:36 ` Andreas Rottmann
  2004-04-26 19:29   ` Andreas Rottmann
@ 2004-04-26 20:24   ` Paul Jarc
  2004-04-26 22:49   ` Daniel Skarda
  2 siblings, 0 replies; 7+ messages in thread
From: Paul Jarc @ 2004-04-26 20:24 UTC (permalink / raw)
  Cc: guile-user, gtk-devel-list

Andreas Rottmann <a.rottmann@gmx.at> wrote:
> (define (app)

Better not call it that, unless you want to break Guile's module
system. :/


paul


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: GLib GObject & Javadot Notation for scheme?
  2004-04-26 18:36 ` Andreas Rottmann
  2004-04-26 19:29   ` Andreas Rottmann
  2004-04-26 20:24   ` Paul Jarc
@ 2004-04-26 22:49   ` Daniel Skarda
  2004-04-27 22:33     ` Andreas Rottmann
  2 siblings, 1 reply; 7+ messages in thread
From: Daniel Skarda @ 2004-04-26 22:49 UTC (permalink / raw)
  Cc: guile-user


Andreas Rottmann <a.rottmann@gmx.at> writes:
[snip - nice gobject example]
>     ;; it like this:
>     (set window 'border-width 20)

 What about srfi-17 syntax?

  (set! (window 'border-width) 20)

0. 



_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: GLib GObject & Javadot Notation for scheme?
  2004-04-26 22:49   ` Daniel Skarda
@ 2004-04-27 22:33     ` Andreas Rottmann
  2004-04-28 17:12       ` Ludovic Courtès
  0 siblings, 1 reply; 7+ messages in thread
From: Andreas Rottmann @ 2004-04-27 22:33 UTC (permalink / raw)
  Cc: guile-user

Daniel Skarda <0rfelyus@ucw.cz> writes:

> Andreas Rottmann <a.rottmann@gmx.at> writes:
> [snip - nice gobject example]
>>     ;; it like this:
>>     (set window 'border-width 20)
>
>  What about srfi-17 syntax?
>
>   (set! (window 'border-width) 20)
>
Sorry, but I don't really know how to achieve that; I think you mean
(set! (border-width window) 20), which would be GOOPS-accessor-style
also. One would have to create accessors for all the GObject
properties at runtime. I think this is a nice idea, but I think one
would have to write some C code to have it.

Andy
-- 
Andreas Rottmann         | Rotty@ICQ      | 118634484@ICQ | a.rottmann@gmx.at
http://yi.org/rotty      | GnuPG Key: http://yi.org/rotty/gpg.asc
Fingerprint              | DFB4 4EB4 78A4 5EEE 6219  F228 F92F CFC5 01FD 5B62

Beware of bugs in the above code; I have only proved it correct,
not tried it.  -- Donald E. Knuth


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: GLib GObject & Javadot Notation for scheme?
  2004-04-27 22:33     ` Andreas Rottmann
@ 2004-04-28 17:12       ` Ludovic Courtès
  0 siblings, 0 replies; 7+ messages in thread
From: Ludovic Courtès @ 2004-04-28 17:12 UTC (permalink / raw)
  Cc: guile-user, Daniel Skarda

Hi,

Yesterday, 18 hours, 33 minutes, 22 seconds ago, Andreas Rottmann wrote:
> Sorry, but I don't really know how to achieve that; I think you mean
> (set! (border-width window) 20), which would be GOOPS-accessor-style
> also. One would have to create accessors for all the GObject
> properties at runtime. I think this is a nice idea, but I think one
> would have to write some C code to have it.

This could easily be achieved with Guile's procedures with setters:

  (define border-with (make-procedure-with-setter border-width-getter
                                                  border-width-setter))

Maybe there are more standard or more goopsish ways to do that, though
(however, `set!' is *not* a generic function in GOOPS so this probably
isn't feasible in pure GOOPS as you said).

Ludovic.


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-04-28 17:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-04-26 15:21 GLib GObject & Javadot Notation for scheme? Linas Vepstas
2004-04-26 18:36 ` Andreas Rottmann
2004-04-26 19:29   ` Andreas Rottmann
2004-04-26 20:24   ` Paul Jarc
2004-04-26 22:49   ` Daniel Skarda
2004-04-27 22:33     ` Andreas Rottmann
2004-04-28 17:12       ` Ludovic Courtès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).