Changeset 34257 in project


Ignore:
Timestamp:
08/06/17 17:05:55 (4 months ago)
Author:
sjamaan
Message:

man/5: Move extensions to R5RS load and eval into "Module scheme" docs. This allows us to eliminate TODO/Unit eval

Location:
wiki/man/5
Files:
1 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/man/5/Module scheme

    r34052 r34257  
    30213021=== Eval
    30223022
    3023 <procedure>(eval expression environment-specifier)</procedure><br>
     3023<procedure>(eval expression [environment-specifier])</procedure><br>
    30243024
    30253025Evaluates expression in the specified environment and returns its
     
    30393039   (f + 10))
    30403040                                                            ===>  20
     3041
     3042The {{environment-specifier}} is optional, and if not provided it
     3043defaults to the value of {{(interaction-environment)}}.  This is a
     3044CHICKEN extension to R5RS, which, though strictly nonportable, is very
     3045common among Scheme implementations.
    30413046
    30423047<procedure>(scheme-report-environment version)</procedure><br>
     
    32643269deserve description here.
    32653270
    3266 <procedure>(load filename)</procedure><br>
     3271<procedure>(load filename [evalproc])</procedure><br>
    32673272
    32683273Filename should be a string naming an existing file containing Scheme
     
    32733278current-output-port. Load returns an unspecified value.
    32743279
    3275 Rationale:   For portability, load must operate on source files.
    3276 Its operation on other kinds of files necessarily varies among
    3277 implementations.
     3280CHICKEN offers a few extensions to the R5RS definition of {{load}}:
     3281
     3282* The {{filename}} may also be an input port.
     3283* The expressions which are read one by one from the source file are passed to the procedure indicated by the extra optional {{evalproc}} argument, which defaults to {{eval}}.
     3284* On platforms that support it (currently BSD, Haiku, MacOS X, Linux, Solaris, and Windows), {{load}} can be used to load shared objects.
     3285
     3286Example for loading compiled programs:
     3287
     3288 % cat x.scm
     3289 (define (hello) (print "Hello!"))
     3290 % csc -s x.scm
     3291 % csi -q
     3292 #;1> (load "x.so")
     3293 ; loading x.so ...
     3294 #;2> (hello)
     3295 Hello!
     3296 #;3>
     3297
     3298There are some limitations and caveats to the CHICKEN extensions you
     3299need to be aware of:
     3300
     3301* The second argument to {{load}} is ignored when loading compiled code.
     3302* If source code is loaded from a port, then that port is closed after all expressions have been read.
     3303* A compiled file can only be loaded once. Subsequent attempts to load the same file have no effect.
     3304
    32783305
    32793306<procedure>(transcript-on filename)</procedure><br>
Note: See TracChangeset for help on using the changeset viewer.