[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
case-lambda integration
From: |
Andy Wingo |
Subject: |
case-lambda integration |
Date: |
Mon, 12 Oct 2009 22:31:30 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (gnu/linux) |
Hello,
I am climbing out of a case-lambda hole, and am wondering about
integration. If you missed the first part of this, check:
http://article.gmane.org/gmane.lisp.guile.devel/9436
The deal is that we need case-lambda, and then some kind of
typecase-lambda to get efficient dispatch of the default generic
function protocol into the VM.
OK then, my wip-case-lambda branch is shaping up, with support for
case-lambda at the VM, debugging, assembly, GLIL, and tree-il levels. I
had to adapt psyntax too to make the new tree-il structures.
In order to expose the case-lambda functionality to Scheme though, we
need a way to make lambdas with more than one case; so I think I will
export case-lambda as an identifier by default.
That is probably uncontroversial.
But what might be is that while I was at it, I made allowances for
efficient optional and keyword argument dispatch -- so we can have
keyword arguments without consing, and arguments which are positionally
optional yet can have keywords. This is so lambda* and define* can be
implemented nicely.
There are hooks in <lambda-case> for these, but again the question is
how to expose to Scheme. As I see it there are two options:
1. Implement lambda* (and define*) in psyntax
-or-
2. Make the stock lambda accept #:optional, #:keyword, et al
arguments (also a hack to psyntax)
I'm kindof leaning towards (2) actually. But I could go either way. Both
ways expose lambda* capability in the default environment -- because
psyntax boots before modules have booted, and these things need access
to psyntax internals.
Perhaps we should do (1) in the interest of interoperability; but you
still have to know you want to code portable Scheme in order to code
portable Scheme. Dunno.
Anyways, input appreciated.
Ciao,
Andy
--
http://wingolog.org/
- case-lambda integration,
Andy Wingo <=