Re: GOOPS constructors

2014-07-22 Thread Tobias Brandt
ext-method @ (list #:msg (format #f "File error in ~S (~S)" path code) #:path path #:code code #:fs fs On 22 July 2014 15:03, Marko Rauhamaa wrote: > Tobias Brandt : > > > Couldn't just define like this: > > > > (define-class ()) > > >

Re: GOOPS constructors

2014-07-22 Thread Tobias Brandt
Couldn't just define like this: (define-class ()) then define a side method: (define-method (side (@ )) (slot-ref @ 'height)) This way, you're not storing the same information twice. On 22 July 2014 14:18, Marko Rauhamaa wrote: > > Consider this simple program: > > ===

Re: Why is an empty lambda body not allowed?

2014-07-04 Thread Tobias Brandt
Hi Taylan, your points are all good and I kind of get the reasoning behind the current semantics. I'm not trying to start a big discussion here, it's just a little detail I noticed and that bothered me. I don't really care what (lambda ()) evaluates to as long as it's consistent with the rest of

Why is an empty lambda body not allowed?

2014-07-04 Thread Tobias Brandt
Hi, it seems to be illegal to write (lambda ()) I would have expected this to evaluate to a procedure returning unspecified. On the other hand, the following are all valid (begin) (define x (begin)) (lambda () x) but (lambda () (begin)) is not. Why is that? Cheers, Tobia

Re: GOOPS: calling next-method with different arguments.

2013-04-21 Thread Tobias Brandt
cheme in the future and thought about how things translate from Java/C#. I know, it's not always a could idea to just literally translate things from one language to another. Cheers, Tobias On 22 April 2013 06:39, Daniel Hartwig wrote: > On 22 April 2013 01:17, Tobias Brandt wrote: >

Re: GOOPS: calling next-method with different arguments.

2013-04-21 Thread Tobias Brandt
x)) ;; change arguments (format #t "bar: ~a\n" x)) (f (make ) 1) => foo: 2 bar: 1 On 21 April 2013 18:05, Tobias Brandt wrote: > Hi, > > thanks for your input. I tried to avoid the whole next-method issue > entirely and defined a method for make on bar's m

Re: GOOPS: calling next-method with different arguments.

2013-04-21 Thread Tobias Brandt
Hi, thanks for your input. I tried to avoid the whole next-method issue entirely and defined a method for make on bar's metaclass instead. (use-modules (oop goops)) (define-class () (s #:init-keyword #:s)) (define-class ()) (define-class () #:metaclass ) (define-method (make (self ) (i ))

GOOPS: calling next-method with different arguments.

2013-04-19 Thread Tobias Brandt
I posed the following question regarding constructors in Lisp/CLOS on stackoverflow: http://stackoverflow.com/questions/16089809/whats-the-equivalent-of-constructors-in-clos The accepted answer uses the ability of CLOS to modifiy the arguments passed to CALL-NEXT-METHOD. I know it's (currently) n

Re: How can I define a new method for display?

2013-04-17 Thread Tobias Brandt
Now I feel stupid. Thanks! On 17 April 2013 23:03, Panicz Maciej Godek wrote: > Howdie! > > 2013/4/17 Tobias Brandt > >> Hi guys, >> >> according to the documentation, when GOOPS is loaded, 'display' becomes a >> generic function. >> >

How can I define a new method for display?

2013-04-17 Thread Tobias Brandt
Hi guys, according to the documentation, when GOOPS is loaded, 'display' becomes a generic function. To wit: scheme@(guile-user)> (use-modules (oop goops)) scheme@(guile-user)> (class-of display) $1 = #< 2cfa3c0> But adding a new method has no effect: scheme@(guile-user)> (define-class ()) s

Re: Mixing syntax-rule and indentifier-syntax

2012-01-17 Thread Tobias Brandt
> 0. I'm sure there is another way, but my mind blanks at the moment After you got me started, I was able to simplify and generalize it a bit. (-> is a GOOPS generic accessor I defined elsewhere. It works with vectors, arrays, strings, etc ...) (define-syntax with-accessors  (lambda (stx)    (synt

Mixing syntax-rule and indentifier-syntax

2012-01-16 Thread Tobias Brandt
Hi, is it possible to define a macro that does one thing when it's in operator position and another when it's not? I want to define a macro `with-vectors` that transforms this: (with-vectors (v) (v 0) (set! (v 0) 'foo) (some-procedure v)) into this: (begin (vector-ref v 0)