<div dir="auto">I agree with your proposed improvement. Could you prepare a pull request?</div><div dir="auto"><br></div><div dir="auto">Thanks,</div><div dir="auto">Luís</div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, 5 Sep 2021 at 04:16, Madhu <<a href="mailto:enometh@meer.net">enometh@meer.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)"><br>
I notice this commit to CFFI:<br>
<br>
<br>
<br>
* commit 743a90251e5a4407147a20bd8354df03a87ca46d<br>
Author: stacksmith <<a href="mailto:stacksmith@users.noreply.github.com" target="_blank">stacksmith@users.noreply.github.com</a>><br>
AuthorDate: Thu Aug 19 06:34:28 2021 -0700<br>
Commit: GitHub <<a href="mailto:noreply@github.com" target="_blank">noreply@github.com</a>><br>
CommitDate: Thu Aug 19 14:34:28 2021 +0100<br>
<br>
Allow local names in WITH-FOREIGN-SLOTS<br>
<br>
It remains compatible with existing code, but accepts additional formats for bindings:<br>
1) (name slot-name) - just like WITH-SLOTS;<br>
2) (name :pointer slot-name) - a pointer version.<br>
<br>
<br>
On Thu, 16 Apr 2020 15:24:52 +0530 I had propsed a similar patch to Luis<br>
With a slightly different signature.<br>
<br>
| <a href="https://github.com/enometh/cffi/commit/023676a25128786174bbaa8a5df7fdc1d27c3bd3" rel="noreferrer" target="_blank">https://github.com/enometh/cffi/commit/023676a25128786174bbaa8a5df7fdc1d27c3bd3</a><br>
| It seems a natural extension to me, though I was not able to<br>
| document it to my satisfaction and I don't know if it would be too<br>
| confusing to others. WDYT - (could clean it up and push it on a<br>
| separate branch if you had comments.)<br>
<br>
The doctring from that patch is reproduced here:<br>
<br>
--<br>
(with-foreign-slots (bindings ptr type) body) - Now each binding can<br>
be one of these forms:<br>
<br>
SLOT-NAME -- binds SLOT-NAME to (FOREIGN-SLOT-VALUE SLOT-NAME)<br>
<br>
(:POINTER SLOT-NAME) -- binds SLOT-NAME to (FOREIGN-SLOT-POINTER<br>
SLOT-NAME)<br>
<br>
(VAR-NAME SLOT-NAME) -- binds VAR-NAME to (FOREIGN-SLOT-VALUE<br>
SLOT-NAME)<br>
<br>
(:POINTER (VAR-NAME SLOT-NAME)) -- binds VAR-NAME<br>
to (FOREIGN-SLOT-POINTER SLOT-NAME)<br>
<br>
(VAR-NAME (:POINTER SLOT-NAME)) -- binds VAR-NAME to<br>
(FOREIGN-SLOT-POINTER SLOT-NAME)<br>
---<br>
<br>
This proposed syntax is different from what has been implemented by<br>
stacksmith: The last two forms above correspond to the form<br>
<br>
(name :pointer slot-name)<br>
<br>
Common Lisp bindings follow a standard syntax LHS RHS<br>
and should always be destructurable to a LHS RHS<br>
<br>
I believe introducing a nonstandard binding form with 3 elements is<br>
not in the spirit of common lisp syntax and it will only necessitate<br>
unnecessary special-casing for further macrology<br>
<br>
I would encourage stacksmith to consider this point and try to adopt<br>
the syntax I proposed for extending with-foreign-slots<br>
<br>
Or would it be possible to support both these forms in addition to the<br>
new 3 element binding form<br>
<br>
It is still early and perhaps that the syntax can be fixed before it<br>
is cast in stone - I'm hoping Luis can cooperate<br>
<br>
<br>
</blockquote></div></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">Luís Oliveira<br><a href="http://kerno.org/~luis/" target="_blank">http://kerno.org/~luis/</a></div>