From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Carlos Pita Newsgroups: gmane.lisp.guile.user Subject: A couple of questions about goops method parameters Date: Tue, 2 Sep 2014 23:05:02 -0300 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1409709952 31798 80.91.229.3 (3 Sep 2014 02:05:52 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 3 Sep 2014 02:05:52 +0000 (UTC) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Wed Sep 03 04:05:46 2014 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XOzxA-0007XW-Sb for guile-user@m.gmane.org; Wed, 03 Sep 2014 04:05:44 +0200 Original-Received: from localhost ([::1]:41028 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOzxA-0006NA-5x for guile-user@m.gmane.org; Tue, 02 Sep 2014 22:05:44 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51791) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOzwr-0006N2-5X for guile-user@gnu.org; Tue, 02 Sep 2014 22:05:25 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XOzwq-0001jU-83 for guile-user@gnu.org; Tue, 02 Sep 2014 22:05:25 -0400 Original-Received: from mail-lb0-x229.google.com ([2a00:1450:4010:c04::229]:49147) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOzwq-0001jN-0d for guile-user@gnu.org; Tue, 02 Sep 2014 22:05:24 -0400 Original-Received: by mail-lb0-f169.google.com with SMTP id l4so8718487lbv.14 for ; Tue, 02 Sep 2014 19:05:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type :content-transfer-encoding; bh=b0BdjkEEUJcCIvkH4GPS0xVdSm75BX53s8rK1qglxjg=; b=e5/vyftC0fiDcKt2ydZlPoeTan1j9S1Lrqowu45jKIgAfqLK8HcaFMoHFShZzDweXI 1Q2hTxArgBtxDe2WzzFy7bB2MO5IEEYyZtb4IgslSB99auRS9X5Cl8do1Q6vY6WvTuNx Xgllqxl32ROH2Pjd7NbGn7O/vYVxMoYFyjcJQbP4mQPjz836PpFK1FIkxjPPx4a1RPJZ CqW7cCElrGYDMSAqEaRMKc0G8wWo3pZv9meCj8ORdbkgTsn6J1gHKrs+fxS9HpC9Vg71 cRtiunNFUIB/ekHQJHMVimWJGFrCCPrdP/3gERUR/tDZTz2V10AW+YRIU0kLLIzJ12ZY KK8w== X-Received: by 10.112.1.136 with SMTP id 8mr37069442lbm.55.1409709922572; Tue, 02 Sep 2014 19:05:22 -0700 (PDT) Original-Received: by 10.112.97.129 with HTTP; Tue, 2 Sep 2014 19:05:02 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c04::229 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:11448 Archived-At: Hi all, I've some questions about parameter handling in goops methods: 1) initialize takes the initargs argument as a list, because of the way make-instance is defined. But the documentation states: In theory, initarg =E2=80=A6 can have any structure that is understood = by whatever methods get applied when the initialize generic function is applied to the newly allocated instance. One could think this implies that initargs won't necessarily be packed as a list. Indeed, that would be very convenient and sensible for custom initialization methods. But make-instance is implemented as: (define-method (make-instance (class ) . initargs) (let ((instance (allocate-instance class initargs))) (initialize instance initargs) instance)) So one would need to rewrite it in order to apply initargs, or something like that, in order to "unpack" the list. How do you typically implement a custom initialization method, then? Using pattern matching? Maybe ice-9 optargs? Maybe apply? Maybe you directly call initialize? In any case, why is this so? Wouldn't it be better for initialize to just get the "unpacked" argument list? This perplexes me. 2) What is the relationship between the lambda* family and methods? Are methods restricted in the sense that they can't aspire to get the greater flexibility of lambda* parameter handling? Maybe because of the way dispatching is done? Thank you very much in advance for any help. Best regards -- Carlos