[前][次][番号順一覧][スレッド一覧][生データ]

langsmith:108

From: Shiro Kawai <shiro lava.net>
Date: Wed, 25 Aug 2004 13:14:41 +0900
Subject: [langsmith:108] Re: パターン支援言語? ご意見拝聴

コードを見直していたら、わざわざMOPを使う必要はないことに気づきました。
create-aggregateを (<symbol> <class> <class>) に対して定義すれば
いいだけですね。

(define-method create-aggregate (name (container <class>) (contained <class>))
  (let ((new-container (apply make (class-of container)
                              :name   (class-name container)
                              :supers (class-direct-supers container)
                              :slots `((,name :init-value ())
                                        ,@(class-slots container))
                              :defined-modules (ref container 'defined-modules)
                              (ref container 'initargs)))
        (new-contained (apply make (class-of contained)
                              :name   (class-name contained)
                              :supers (class-direct-supers contained)
                              :slots `((,(string->symbol #`",|name|-parent")
                                        :init-value #f)
                                       ,@(class-slots contained))
                              :defined-modules (ref contained 'defined-modules)
                              (ref contained 'initargs)))
        )
    (redefine-class! container new-container)
    (redefine-class! contained new-contained)
    (values new-container new-contained)))

等。

--shiro

--
ML: langsmith quickml.atdot.net
使い方: http://www.atdot.net/~ko1/quickml

[前][次][番号順一覧][スレッド一覧][生データ]

        96 2004-08-21 23:23 [ttn3w7u2fs mx6.ttcn.] パターン支援言語? ご意見拝聴           
        97 2004-08-22 13:13 ┗[takuo aya.or.jp     ]                                       
        98 2004-08-22 22:34  ┗[ttn3w7u2fs mx6.ttcn.]                                     
        99 2004-08-23 10:12   ┗[takuo aya.or.jp     ]                                   
       100 2004-08-23 22:47    ┗[ttn3w7u2fs mx6.ttcn.]                                 
       101 2004-08-23 23:29     ┣[eclipse cspc.jp     ]                               
       102 2004-08-24 22:38     ┃┗[ttn3w7u2fs mx6.ttcn.]                             
       103 2004-08-25 00:11     ┃ ┣[eclipse cspc.jp     ]                           
       107 2004-08-25 11:27     ┃ ┗[shiro lava.net      ]                           
->     108 2004-08-25 13:14     ┃  ┗[shiro lava.net      ]                         
       105 2004-08-25 00:30     ┗[takuo aya.or.jp     ]                               
       110 2004-08-30 22:29      ┗[ttn3w7u2fs mx6.ttcn.]