{"size": 1108, "ext": "scrbl", "max_stars_repo_path": "web-server-doc/web-server/scribblings/native.scrbl", "max_stars_repo_name": "jessealama/web-server", "max_stars_repo_stars_event_min_datetime": "2015-01-21T08:11:58.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-20T08:28:39.000Z", "max_issues_repo_path": "web-server-doc/web-server/scribblings/native.scrbl", "max_issues_repo_name": "jessealama/web-server", "max_issues_repo_issues_event_min_datetime": "2015-01-14T08:06:37.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-12T14:38:40.000Z", "max_forks_repo_path": "web-server-doc/web-server/scribblings/native.scrbl", "max_forks_repo_name": "jessealama/web-server", "max_forks_repo_forks_event_min_datetime": "2015-03-05T15:07:36.000Z", "max_forks_repo_forks_event_max_datetime": "2021-07-30T18:59:25.000Z"}
{"max_stars_count": 82, "max_issues_count": 105, "max_forks_count": 37, "avg_line_length": 26.380952381, "max_line_length": 72, "alphanum_fraction": 0.6678700361}
#lang scribble/doc
@(require "web-server.rkt")

@title[]{Native Interfaces}

@(require (for-label racket
                     web-server/lang/native
                     web-server/lang/abort-resume))

@defmodule[web-server/lang/native]{

It is sometimes inconvenient to use @racket[serial->native] and
@racket[native->serial] throughout your program.  This module provides a
macro for creating wrappers.

@defform[#:literals (ho)
         (define-native (native arg-spec ...) original)
         #:contracts ([arg-spec ho] [arg-spec _])]{
 Builds an interface around @racket[original] named @racket[native] such
 that calls to @racket[native] are wrapped in @racket[serial->native]
 and all arguments marked with @racket[ho] in @racket[arg-spec] are
 assumed to procedures and are wrapped in @racket[native->serial].

 For example,
 @racketblock[
  (define-native (build-list/native _ ho) build-list)
 ]

 is equivalent to
 @racketblock[
  (define (build-list/native fst snd)
    (serial->native
     (build-list 
      fst
      (lambda args
        (native->serial
         (apply snd args))))))
  ]
 }

}
