2 Aug 2008 05:36
Re: write-object from write vs. from display
Shiro Kawai <shiro <at> lava.net>
2008-08-02 03:36:36 GMT
2008-08-02 03:36:36 GMT
From: "Leonardo Boiko" <leoboiko <at> gmail.com> Subject: Re: [Gauche-devel] write-object from write vs. from display Date: Tue, 29 Jul 2008 19:57:25 -0300 > 2008/7/29 Shiro Kawai <shiro <at> lava.net>: > > How about this. In your write-object method you can call write-mode > > procedure that returns a symbol indicating which mode it is called. > > > > (write-mode) => a symbol > > I still don't get it; will the user ever need to set the write-mode? > If not, wouldn't it be simpler to just make write-object receive two > arguments, the object and the write-mode? That was the original plan. The problem is this: It is quite common to call 'format' from write-object, but there's no way to pass the mode info to 'format'. (define-method write-object ((obj <my-object>) port mode) (format port "...." ...)) We can add a new function, say 'format/mode' and 'format/ss/mode', that takes extra mode argument. But we can't save the existing write-object methods that are using standard 'format'---it means for any recursive structure, we can't rely on the mode argument to propagate down. With the parameter approach, we don't need to worry about propagation part. --shiro(Continue reading)
RSS Feed