unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* srfi-89 implementation for guile
@ 2020-08-10 20:07 Martin Becze
  2020-08-10 21:26 ` Linus Björnstam
  2020-08-11 21:24 ` Leo Butler
  0 siblings, 2 replies; 4+ messages in thread
From: Martin Becze @ 2020-08-10 20:07 UTC (permalink / raw)
  To: Guile Users' Mailing List


[-- Attachment #1.1: Type: text/plain, Size: 226 bytes --]

Hi Guilers,
I implemented srfi-89 (Optional positional and named parameters)
https://gitlab.com/mjbecze/guile-srfi-89/

It is hygienic and reuses guile's lambda* so there is minimal overhead.

Cheers!,
-Martin Becze


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: srfi-89 implementation for guile
  2020-08-10 20:07 srfi-89 implementation for guile Martin Becze
@ 2020-08-10 21:26 ` Linus Björnstam
  2020-08-11  1:40   ` Martin Becze
  2020-08-11 21:24 ` Leo Butler
  1 sibling, 1 reply; 4+ messages in thread
From: Linus Björnstam @ 2020-08-10 21:26 UTC (permalink / raw)
  To: Martin Becze, Guile Users' Mailing List

Well done! Macros are great fun. I glanced through your source and could follow it without much hickups. You probably know this already, but you can actually do the sanitize-rest at compile time for cases where the procedure is not passed as an argument to some.other procedure.

Say we (define* (blah ...) Body...).

Then you define one function that does argument checking (%blah-check) at runtime and one that does not (%blah)

Then make the regular blah a macro. Using identifier macros you dispatch to %blah-check if it is not used in call position, or check all keyword arguments and sanitize them at compile time and dispatch it to %blah. 

I spent some time implementing define-inlinable*, a keyword-aware define-inlinable, using that. I never baked it fully, so I never submitted a patch, but that is the approach I took, and the approach that define-inlinable uses which you can find in the guile sources.



-- 
  Linus Björnstam

On Mon, 10 Aug 2020, at 22:07, Martin Becze wrote:
> Hi Guilers,
> I implemented srfi-89 (Optional positional and named parameters)
> https://gitlab.com/mjbecze/guile-srfi-89/
> 
> It is hygienic and reuses guile's lambda* so there is minimal overhead.
> 
> Cheers!,
> -Martin Becze
> 
> 
> Attachments:
> * signature.asc



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: srfi-89 implementation for guile
  2020-08-10 21:26 ` Linus Björnstam
@ 2020-08-11  1:40   ` Martin Becze
  0 siblings, 0 replies; 4+ messages in thread
From: Martin Becze @ 2020-08-11  1:40 UTC (permalink / raw)
  To: Linus Björnstam, Guile Users' Mailing List


[-- Attachment #1.1: Type: text/plain, Size: 1128 bytes --]



On 8/10/20 4:26 PM, Linus Björnstam wrote:
> Well done! Macros are great fun. I glanced through your source and could follow it without much hickups. 

Thanks! It has been good learning experience.

> You probably know this already, but you can actually do the sanitize-rest at compile time for cases where the procedure is not passed as an argument to some.other procedure.
> 
> Say we (define* (blah ...) Body...).
> 
> Then you define one function that does argument checking (%blah-check) at runtime and one that does not (%blah)
> 
> Then make the regular blah a macro. Using identifier macros you dispatch to %blah-check if it is not used in call position, or check all keyword arguments and sanitize them at compile time and dispatch it to %blah. 
> 
> I spent some time implementing define-inlinable*, a keyword-aware define-inlinable, using that. I never baked it fully, so I never submitted a patch, but that is the approach I took, and the approach that define-inlinable uses which you can find in the guile sources.
> 

I hadn't thought of this at all. Interesting idea, might give it a try.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: srfi-89 implementation for guile
  2020-08-10 20:07 srfi-89 implementation for guile Martin Becze
  2020-08-10 21:26 ` Linus Björnstam
@ 2020-08-11 21:24 ` Leo Butler
  1 sibling, 0 replies; 4+ messages in thread
From: Leo Butler @ 2020-08-11 21:24 UTC (permalink / raw)
  To: Guile Users' Mailing List

Martin Becze <mjbecze@riseup.net> writes:

> Hi Guilers,
> I implemented srfi-89 (Optional positional and named parameters)
> https://gitlab.com/mjbecze/guile-srfi-89/
>
> It is hygienic and reuses guile's lambda* so there is minimal overhead.
>
> Cheers!,
> -Martin Becze

In

https://gitlab.com/mjbecze/guile-srfi-89/-/blob/master/srfi/srfi-89.scm

the header refers to guile-json a couple times.

Leo



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-08-11 21:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-10 20:07 srfi-89 implementation for guile Martin Becze
2020-08-10 21:26 ` Linus Björnstam
2020-08-11  1:40   ` Martin Becze
2020-08-11 21:24 ` Leo Butler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).