This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: SMOBs (was: Re: mildly incompatible change)


Jim Blandy <jimb@red-bean.com> writes:

> > Well, only those types ("tags" I guess you'd say) with a non-NULL
> > (*call) member would be callable.  Are you suggesting that foreign
> > functions should be something other than smobs altogether?
> 
> Not exactly --- I'm saying that I'm not keen on having objects whose
> primary purpose is something other than representing a function be
> callable as if it were a function.
> 
> So, for example, if you had some smobs that were callable, and other
> smobs that served other purposes, and the two were distinct, that
> would be cool.

One of the recent changes to SCM was the transmogrification of
tc7_cclo into tc7_specfun.  Bits 8-15 are used as a type tag ala smobs
and the upper 16 bits are available as a length spec for cclos.  So
far there are three types: tc16_cclo, tc16_apply, and tc16_call_cc.
The latter two are handled specially in the evaluator, which means
that APPLY and CALL-WITH-CURRENT-CONTINUATION no longer need be
closures for the sake of tail recursiveness.

@CALL-WITH-CURRENT-CONTINUATION is gone.  Aubrey has taken a shine to
@APPLY, so it is still there, but no longer used for implementing
APPLY.

In the first cut, I did APPLY and CALL/CC as special, callable, smobs.
This worked, but having a separate type for function extension is in
my opinion a better approach.