Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • May 05 15:01
    Travis gambit/gambit (v4.9.0) passed (1583)
  • May 05 14:51

    feeley on v4.9.0

    (compare)

  • May 05 14:51

    feeley on v4.9.0

    (compare)

  • May 05 13:52
    CI run 813517185 passed
  • May 05 13:16

    feeley on master

    Keep only the "INSIDE_EMACS" de… Merge branch 'master' of github… (compare)

  • May 04 17:59
    CI run 810839381 passed
  • May 04 17:19

    gambiteer on master

    Update SRFI 179 generalized-ar… (compare)

  • May 03 11:55
    CI run 806636559 passed
  • May 03 11:20

    feeley on master

    Remove six.prefix form (compare)

  • May 02 20:25
    CI run 804932802 passed
  • May 02 19:43

    feeley on master

    Universal backend: connect curr… (compare)

  • May 02 17:33
    MacOS build of CI run 804702347 failed
  • May 02 17:16

    feeley on master

    Universal backend: allow creati… (compare)

  • May 02 15:03
    lassik opened #688
  • May 02 04:12
    Windows-mingw build of CI run 803525339 failed
  • May 02 03:46

    feeley on master

    Universal backend: add meta-inf… (compare)

  • May 01 16:25
    CI run 802492973 passed
  • May 01 15:46

    feeley on master

    Test simpler CI Windows/mingw b… (compare)

  • May 01 15:26
    Windows-mingw build of CI run 802422058 failed
  • May 01 15:01

    feeley on master

    Fix issue on Windows/mingw with… (compare)

Marc Feeley
@feeley
also… if you compile your program then all of the processing of the module definitions is done by the compiler, so you will not see a run time hit
yes I agree with you that there is a problem… I’m just saying there are issues with adding a cache
Jürgen Geßwein
@jgesswein
All the libraries are compiled. Each has its own dynamic library. Only the main application is not compiled as it is a script for now.
Marc Feeley
@feeley
please add an issue on the github repo… this is definitely something that will hinder using the module system
Jürgen Geßwein
@jgesswein
May be I do something wrong with compiling libraries? Current I build the libraries using «gsc . path/to/lib». This yields a dynamic library and a C file in a folder «path@gambit409003@C».
OK, I’ll add an issue.
Marc Feeley
@feeley
yes that is the correct way to compile a library… you can also install the library if you don’t want to specify . when you run the program (so that it can find the compiled libraries)
let me add that it might be useful to store the library definition in the compiled modules so that a program that is statically linked can do dynamic imports (as in (eval ‘(import …))) of the linked modules without having to go to the filesystem
Jürgen Geßwein
@jgesswein
Sounds good. I need some more advice on how to do that. Currently I am not building a statically linked application as compiling takes also quite some time… ;-)
Marc Feeley
@feeley

the multiple imports of _test are due to the way the macros are written… for example test-equal is defined like this :

(##define-syntax test-equal       (lambda (src)
                                    (##import _test/test-expand)
                                    (test-expand src 'test-equal)))

so every call to test-equal will cause a import to be processed

clearly a cache would help, but maybe a rewrite of the macros would be sufficient
I suspect you have a program with a large number of tests...
Jürgen Geßwein
@jgesswein
Is 676 a large number? I am currently not using library _test but some home-grown stuff for historial reasons.
Marc Feeley
@feeley
sorry my analysis is wrong… the import is just done once per macro definition (not every macro call)
can I see your test library?
Jürgen Geßwein
@jgesswein
I’ll take a look at the 36MB file and give you some number on how often the libraries are loaded. You can then decide with more confidence on a cache.
Sure, why not. I drop you an e-mail. Is your university address OK?
Marc Feeley
@feeley
yes
36MB/676 is about 50KB per test… (if each test is generating some imports)… 50KB would be a lot!
Jürgen Geßwein
@jgesswein
Well that file is just for loading the libraries. The tests did not yet run. I create function with tests and run those functions. This allows for a progress bar.
Marc Feeley
@feeley
I see… but still each macro call may be causing some imports… and these are processed at macro expansion time (before execution)
Jürgen Geßwein
@jgesswein
I think I do not do this. But you may have a look at the module.
amirouche
@amirouche

Here is an extract from an article I am writing:

I experimented with Gambit JavaScript target, looked at the
benchmarks (but I did
not run them myself, yet), read on the Termite library that is inspired from
Erlang, and the upcoming Scheme Infix eXpression (SIX) already
available in master branch: In the years to come, Gambit Scheme
will become the goto programming stack for industrial use
. Here is
why:

  • Gambit Scheme is a Scheme;

  • Termite is what you need to build an application distributed in a
    controlled environnement, without requiring a change of programming
    language (see Erlang);

  • Gambit can also target the web browser;

Otherwise stated: we will be able to build full-stack applications
that can scale painlessly thanks to Termite, with a single great
programming language, the same compiler, and interpreter backend-side
and frontend-side.

Anyway, even if I am bit scared, I will try to use Gambit.
Jürgen Geßwein
@jgesswein
Something that also makes using the module system hard is that Gambit does not complain if a library contains identifiers that it cannot resolve. At least a warning would be helpful. Especially if an identifier in export is not defined.
amirouche
@amirouche
that is a known (by me) problem, and fwiw not the only one, for instance the module system requires to explicitly export dependent forms of a macro. And they are some things that may be trivial, but very great such as a directory contains all the files that defines the library unlike the foo.sld that includes foo/body.scm. Also, the ability to specify a git repository is great, it alleviates the need for a package management tool.
AFAIU it is possible to layer on top of Gambit the project called unsyntax (or fork) it support all macro systems (I will give it try at some point).
Speaking of library system and JS target, it would be easier for me if it produced a single .js file.
Marc Feeley
@feeley
@amirouche nice to hear your praise of Gambit (current and future)!
what do you mean “if it produced a single .js file”? that is what is produced by -exe… and if you want that wrapped in a trivial HTML you can -exe -o foo.html
amirouche
@amirouche
Last time I tried to compile a program.scm with (import (foobar)), there was several messages in the browser console about failed attempts to retrieve foobar.sld over the network.
I use -:r7rs
Marc Feeley
@feeley
if you do a static link then the dynamic module loading will not happen (unless you forgot to link the module in!)
amirouche
@amirouche
I will look into static link.
Marc Feeley
@feeley
one issue with the current static linker is that you have to help it out with locating the modules (ideally it should be automatic and this is on my TODO)… also you have to use the -nopreload linker option
amirouche
@amirouche
Re JS promise, does the resolution of promise block or pause only the current thread? Hence it would be possible to spawn two threads and do a fetch in each of them?
Related question is: is call/cc fast? In my prototype, I use call/cc to implement "non-colored async that look sync" similar to what Gambit has builtin with the lightweight threads and network io.
Ultimately, what would be the best way to implement network io browser side without blocking.
Marc Feeley
@feeley
yes waiting for promise results is done on a thread by thread basis (that’s one of the difficulties in implementing this and frankly it would lose a lot of value if it wasn’t that way)
yes call/cc is “fast” (the Scheme thread scheduler uses call/cc or rather continuation-capture to switch threads)
what is “network i/o”? fetch?
you can spawn N Scheme threads, each doing a JS fetch and it will all be concurrent (it is one of the examples in the paper I shared with you, which will be presented at ELS21 by the way)
amirouche
@amirouche
By "network i/o" I mean fetch and websockets.
Marc Feeley
@feeley
all of that currently works well

try this on https://gambitscheme.org/try

(define-syntax future
  (lambda (stx)
    (syntax-case stx ()
      ((future expr)
       #'(thread (lambda () expr))))))

(define touch thread-join!)

(define (pmap f lst)   ;; "parallel" map
  (map touch (map (lambda (x) (future (f x))) lst)))

(define memo
  (string-append
   "Scheme_-_An_interpreter_for_extended_"
   "lambda_calculus.djvu"))

(define (page n)
  (string-append
   "https://upload.wikimedia.org/wikipedia"
   "/commons/thumb/1/1e/" memo
   "/page" (number->string n) "-593px-" memo ".jpg"))

(define (fetch-blob url)
  \fetch(`url).then(function (r) { return r.blob(); }))

(define (->URL blob)
  \URL.createObjectURL(`blob))

(define (show url)
  \document.body.insertAdjacentHTML(
   "beforeend",
   "<img src='"+(`url)+"' width=200px>"))

(define images
  (pmap (lambda (n) (->URL (fetch-blob (page n))))
        (iota 43 1)))

(for-each show images)

you should see all the pages appear quickly… if you replace pmap by map it will be 10x slower

amirouche
@amirouche
Indeed! Thanks again for your precious time.
Drew Crampsie
@drewc
OMG!! I have not tried that part yet but am about to ... we auto-resolve promises? So the async appears synchronous in (use-result-value (promise-value))??
drewc @drewc REPL'ies to himself ...
Drew Crampsie
@drewc
Oh that is very very cool.