Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Sep 22 23:41
    Negdayen closed #783
  • Sep 22 23:41
    Negdayen commented #783
  • Sep 22 04:12
    CI run 3102543514 passed
  • Sep 22 02:55
    feeley commented #784
  • Sep 22 02:55

    feeley on master

    Fix crash in http module when t… (_http) library: add validation… Merge pull request #784 from Fr… (compare)

  • Sep 22 02:55
    feeley closed #784
  • Sep 22 02:20
    FredericHamel opened #784
  • Sep 21 01:49
    Negdayen opened #783
  • Sep 20 17:48
    CI run 3091802769 passed
  • Sep 20 16:30
    MacOS build of CI run 3091802769 failed
  • Sep 20 16:29

    feeley on master

    Universal backend: correctly ge… (compare)

  • Sep 15 17:09
    gambiteer closed #728
  • Sep 15 17:09
    gambiteer commented #728
  • Sep 15 17:08
    gambiteer commented #765
  • Sep 15 02:40
    Windows-msvc build of CI run failed
  • Sep 15 02:19

    feeley on string-contains

    (compare)

  • Sep 15 02:19

    feeley on master

    Add string-contains, string-pre… Merge pull request #782 from ga… (compare)

  • Sep 15 02:19
    feeley closed #782
  • Sep 15 00:58
    CI run 3057012098 passed
  • Sep 15 00:37

    feeley on string-contains

    Add string-contains, string-pre… (compare)

Bradley Lucier
@gambiteer
Where will I find a description of how to define a type or a structure, etc., where I can declare whether there's a copier for the structure, whether fields are immutable, etc.
cs7
@cs7:matrix.org
[m]
gambiteer (Bradley Lucier): what about look up define-type in Gambit’s sourcew
s
Bradley Lucier
@gambiteer
I found an mail list email from Marc with subject line "Re: Gambit Version 4.0 beta 9 / define-structure issue" on 10/13/2004 with some info.
Marc-André Bélanger
@belmarca
Bradley Lucier
@gambiteer
Thanks. So it appears that define-type and define-structure are basically the same. Is there a grammar that this code parses, or is it just whatever the code accepts? (I realize that sounds a bit snarky, but it's a real question.)
Marc Feeley
@feeley

@gambiteer The define-type form is identical to define-structure. It is also easy to map define-record-type to define-type. It is done with:

(define-runtime-macro (##define-record-type name constructor predicate . fields)
  `(##define-type ,name
     constructor: ,constructor
     copier: #f
     predicate: ,predicate
     no-functional-setter:
     ,@fields))

Some documentation is here: https://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20090226/af2ee44c/attachment.txt
It would of course be good to define the form properly in the Gambit manual. I’ve added an issue for this on the github repo.

cs7
@cs7:matrix.org
[m]
feeley (Marc Feeley): To recap the definition of a module: it is a directory and the directory contains, let’s see, a .sld or .scm or .six file with the body code of the module, and then also a #.scm with headers that are automatically ##include:d by (import)?
Apart from those two, the build output ends up in the module’s own directory and finally the module may ##include files in turn and those would be sought for (have as search path, relative current directory) in the module directory -
cs7
@cs7:matrix.org
[m]
And then a module can contain setup.scm and module directories can have module subdirectories = recursive structure
Is this all the use the fact, that each module has its own directory, has or can a directory contain anything more of significance than what was said above here?
cs7
@cs7:matrix.org
[m]
All, in Aug-Oct would you be up for a group zoom call with Marc where he explains compiler internals and more?
cs7
@cs7:matrix.org
[m]
feeley (Marc Feeley): The time infos processed by Gambit eg in the floats slot in the thread struct, is it that any relative timeout eg (thread-sleep! 0.001) in Gambit gets translated to absolute time and then frequently ends up processed in C Gambit internals, and this is the reason the absolute time is always f64 or 64bit uint?
cs7
@cs7:matrix.org
[m]

For fixes to bugs in the SMP support, 15x 100 EUR bounties are allocated. Feel tree to fix a bug and claim a bounty 👍

If one person intends to claim more than 2-3 bounties please discuss with donor in advance.

Bounty is due when validated that the bug was real and the solution is adopted by Gambit: ie an official Gambit function per the Gambit manual, that works in unicore Gambit and did not work in SMP Gambit, and with the claimant’s fix the bug is solved, and the particular PR offered is viewed as reference grade so much that it’s accepted for adoption to Gambit.

Method for transfer of the bounty eg paypal, bank, cash, crypto etc. discussed when bounty payment is due.

No particular expiry date on this offer eg 10 years (1 Jan 2032).

(Offer is nonbinding in the sense subject to current sanctions etc applicable regulations.)

Supposedly there are some easy to find and solve bounties in the SMP support now.

A bit down the line difficulty may go up and the bounty offer may be raised.

Marc Feeley
@feeley
@cs7:matrix.org That’s a great initiative on your part to weed out the issues in the SMP support and make it reliable for everyday use. I have added a “donation” button to the Gambit github repo landing page (and will soon add it to the gambitscheme.org page) so that the Gambit project can have access to some funds for offering bug bounties on other types of bugs and rewards for other contributions (SRFIs, new modules, ports of modules of other Scheme systems, etc).
Jaime Fournier
@ober
Where do we submit new bounties?
Marc Feeley
@feeley
@ober To announce a bounty that you are willing to pay, just add an issue and indicate the details of the bounty. If you want to contribute funds so that we (the Gambit maintainers = me) can offer bounties then just click the button on the Gambit github repo README (in the “Contributing” section).
Jaime Fournier
@ober
:thumbsup:
Steve Bigham
@vesten

Question re: the FFI and C function pointers. If I have this in C,

int cfcn (int (*cb)()) {
    cb();
}

and this in scheme,

(define call-cfcn
  (c-lambda ((function () int)) int "cfcn"))

(c-define (scmcallback) () int "cname" ""
  (display " ** scheme callback\n"))

(call-cfcn scmcallback)

I receive the message, 'ERROR (Argument 1) Can't convert to C function' upon executing instead of the ' ** scheme callback' message. What have I missed or mis-read?

Marc Feeley
@feeley
@vesten I’m not sure which version of Gambit you are using, but this works fine:
$ gsc -v
v4.9.4-39-g9a887b80 20220503145411 x86_64-apple-darwin21.4.0 "./configure '--enable-single-host' 'CC=gcc-9'"
$ gsc cffi.scm
$ gsi cffi.o1
 ** scheme callback
42
$ cat cffi.scm
(c-declare "

int cfcn (int (*cb)()) {
  return cb() * 7;
}

")

(define call-cfcn
  (c-lambda ((function () int)) int "cfcn"))

(c-define (scmcallback) () int "cname" ""
  (display " ** scheme callback\n")
  6)

(pp (call-cfcn scmcallback))
Steve Bigham
@vesten
@feeley Thanks for taking up something so trivial Marc. I'm using the Void Linux 4.9.4 Gambit package and can reproduce your results. Checking back with my original code, I had a typo - called scmcccallback <facepalm>. Ultimately I'm trying to interface to Lua and am having trouble with a function that pushes a function pointer to the Lua stack. I'll check for PEBKAC issues. Sorry for the stumble.
cs7
@cs7:matrix.org
[m]
Just curious, is there a Rust language backend, would it have tail calls or other features that make it a suitable target. Not a suggestion, just curious.
Marc Feeley
@feeley
@cs7:matrix.org There is no Rust backend currently or in the works. I don’t see immediate advantages to using Rust as a target language… it is hard to beat C for portability and execution speed. Last time I checked, Rust did not have TCO so a trampoline would be needed, like C/C++. A backend as complete as the C backend is a multi-year effort. An extension to the universal backend for Rust would be an easier task but with unclear optimizability to achieve max performance.
Ben Cornett
@cornett

If I compile the following:

(let loop ((i 0))
  (when (< i 100000000)
    (display i)
    (newline)
    (loop (+ i 1))))

and then pipe the output to head like this

 ./x | head

the pipeline appears to hang. I'm not sure what ./xis doing, since it has no place to write to, but it nevertheless consumes a lot of cpu time.

Jaime Fournier
@ober
does display add a \n?
Bradley Lucier
@gambiteer
No.
Marc-André Bélanger
@belmarca
An equivalent Python program has a different behavior
➜  flub cat foo.py
i = 0
while i < 10000:
    print(i)
    i+=1
➜  flub python3.10 foo.py | head  
0
1
2
3
4
5
6
7
8
9
Traceback (most recent call last):
  File "/tmp/flub/foo.py", line 3, in <module>
    print(i)
BrokenPipeError: [Errno 32] Broken pipe
Marc Feeley
@feeley

@cornett By default the interpreter uses stdin and stdout as the “REPL channel” to interact with the user. This can be changed with the -:dc runtime option so that the REPL channel is connected to the controlling terminal. This allows observing the error:

$ cat head.scm
(let loop ((i 0))
  (when (< i 100000000)
    (display i)
    (newline)
    (loop (+ i 1))))
$ gsi -:dc head.scm | head
0
1
2
3
4
5
6
7
8
9
*** ERROR IN ##wr-substr -- Broken pipe
(write-substring "923" 0 3 '#<output-port #2 (stdout)>)

So when the -:dc option is not used the runtime system will attempt to output this error message on the REPL channel which is stdout, but this generates a similar error that the runtime system tries to output to stdout, and an infinite error loop results.
In the past Gambit used the controlling terminal for the REPL channel, but this was changed because users found this to give surprizing behavior, in particular they expect echo "(+ 1 2) (exit)" | gsi to feed the REPL with commands, which did not work when the controlling terminal is used as the REPL channel.
If you prefer the old behavior, you could set the GAMBOPT environment variable with export GAMBOPT=dc

Note also that you can get more context for the error by adding 2 or 3 to the -:d runtime option:
$ gsi -:d2c head.scm | head
0
1
2
3
4
5
6
7
8
9
*** ERROR IN ##wr-substr -- Broken pipe
(write-substring "923" 0 3 '#<output-port #2 (stdout)>)
0  ##wr-substr             
1  ##write-generic-to-character-port 
2  ##display               
3  loop                    "head.scm"@3:5          (display i)
4  (interaction)           "head.scm"@1:1          ((letrec ((loop (lambda (...
5  ##load                  
6  ##load                  
7  ##main                  
$ gsi -:d3c head.scm | head
0
1
2
3
4
5
6
7
8
9
*** ERROR IN ##wr-substr -- Broken pipe
(write-substring "923" 0 3 '#<output-port #2 (stdout)>)
0  ##wr-substr             
1  ##write-generic-to-character-port 
2  ##display               
3  loop                    "head.scm"@3:5          (display i)
        i = 923
        loop = (lambda (i) (if (< i 100000000) (begin (display i) (newlin... #3
4  (interaction)           "head.scm"@1:1          ((letrec ((loop (lambda (...
5  ##load                  
6  ##load                  
7  ##main
Marc Feeley
@feeley
Yet another option is the -:d0 runtime option that does not output error messages, so the infinite error loop is not even entered:
$ gsi -:d0 head.scm | head
0
1
2
3
4
5
6
7
8
9
$
Ben Cornett
@cornett
@feeley Thanks Marc! That makes sense now. I also appreciate the effort you have put into the debugging facilities. Some other scheme implementations I've used leave a lot to be desired in that regard.
cs7
@cs7:matrix.org
[m]

(Repeat,) there will be a video call a bit later this year with Marc to learn more about compiler internals.

Datetime TBD. Feel free to signal interest to me and i’ll remind when it approaches.

Bob Coleman
@skilldown
@cs7:matrix.org I'm definitely interested in the call. Gambit@30 was a blast and I'd love to learn more about the compiler.
Bheesham Persaud
@bheesham

hey all. i seem to be having trouble compiling gambit (just cloned from github) on fedora 36 (GCC 12.1.1)

the output is

gcc -Wno-unused -Wno-write-strings -Wdisabled-optimization -fwrapv -fno-strict-aliasing -fno-trapping-math -fno-math-errno -fschedule-insns2 -foptimize-sibling-calls -fomit-frame-pointer -march=native -fPIC -fno-common -mpc64
    -Wno-unused -Wno-write-strings -Wdisabled-optimization -fwrapv -fno-strict-aliasing -fno-trapping-math -fno-math-errno -fschedule-insns2 -foptimize-sibling-calls -fomit-frame-pointer -march=native -fPIC -fno-common -mpc64
   -rdynamic  -I"../include"  -o gsi    _gsi.o _gsi_.o "../lib/libgambit.a"  libgambitgsi.a                                                                                                                                      
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H___num':                         
_num.c:(.text+0x25b73): undefined reference to `log1p'                                                          
/usr/bin/ld: _num.c:(.text+0x25c9f): undefined reference to `atan'                                              
/usr/bin/ld: _num.c:(.text+0x2652e): undefined reference to `log' 
/usr/bin/ld: _num.c:(.text+0x26df6): undefined reference to `exp'  
/usr/bin/ld: _num.c:(.text+0x26f12): undefined reference to `exp'

the configure command was:

./configure --enable-single-host --enable-march=native --enable-dynamic-clib

I can get further if I add CFLAGS="-lm" to my environment, but it just fails past that. did anyone run into this before? is there something i'm missing?

Bheesham Persaud
@bheesham

though, interestingly the docker build passes. I tried with:
./configure --enable-single-host --enable-march=native --enable-dynamic-clib && docker build -t gambit .
(again in a fresh repo)

hhmmm... I'm not too sure what's going on here

Bheesham Persaud
@bheesham
ah! so i think there's something wrong with my machine (or potentially some flags?) -- i was able to build gambit using fedora:latest (see this Dockerfile: https://gist.github.com/bheesham/13b690846017b01ad7aec1b49ef498a4)
Bheesham Persaud
@bheesham
uh, nvm, seems like asking for help fixed my problem. I ended up calling a bunch of variations of ./configure and now the original command works. :tada:
Marc Feeley
@feeley
@bheesham could you explain what worked? some other people have encountered a similar experience so it would be good to point them to a solution.
4 replies
cs7
@cs7:matrix.org
[m]
feeley (Marc Feeley): Is the Gambit wiki obsoleted?
Marc Feeley
@feeley
@cs7:matrix.org The Gambit wiki is no longer being updated and is in read-only mode (because there was too much spam). I don’t have time to police it or maintain it but if someone wants to do it then that would be OK. So the current plan is to keep it as-is for people who want to find some documentation there (and for hyperlinks to the wiki to remain valid)
cs7
@cs7:matrix.org
[m]
Aha. Uu. Wait, only email signuped users had write access wasn’t it
What about just saying after email signup also needs moderator approval?
Marc Feeley
@feeley
there was a captcha but that wasn’t foolproof…
The wiki was never very active and there were only a few contributors… if someone wants to maintain it I can give them access.
cs7
@cs7:matrix.org
[m]
Invite only wiki makes sense
Bheesham Persaud
@bheesham

may I have an invite to the wiki please? there's a quick link I want to update.

the link to the mailing list on https://gambitscheme.org/wiki/index.php?title=How_to_contribute is broken, as reported in gambit/gambit#750, similar to gambit/gambit#495 (now closed)

Marc Feeley
@feeley
I have changed the settings on the wiki so that all current users can edit pages. I’ll add new users manually so I can filter out spammers. So if you want an account please DM or email me. If there is enough interest we can un-phase-out the wiki...
Bheesham Persaud
@bheesham
thank you! :)

re: the flags used to configure gambit

I'm not entirely sure what to think about that. it seems strange that I'd need to build with --enable-dynamic-clib (or any of the variations I found to work) and then pass in all the flags I want afterwards