Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 27 13:00
    feeley commented #661
  • Jan 26 23:58
    c0nn3r closed #661
  • Jan 26 23:58
    c0nn3r commented #661
  • Jan 26 23:49
    feeley commented #661
  • Jan 26 23:48
    feeley commented #661
  • Jan 26 23:36
    c0nn3r opened #661
  • Jan 26 22:13
    CI run 513354308 passed
  • Jan 26 21:35

    feeley on master

    Fix export of define-type exten… (compare)

  • Jan 26 21:19
    feeley commented #660
  • Jan 26 20:51
    lassik commented #660
  • Jan 26 20:48
    lassik opened #660
  • Jan 26 17:04
    Windows-mingw build of CI run 512712433 failed
  • Jan 26 16:43

    feeley on master

    Fix export of define-type (compare)

  • Jan 26 01:40
    CI run 510833688 passed
  • Jan 26 01:05
    gambiteer commented #651
  • Jan 26 01:04

    gambiteer on master

    Make fdigits available to all u… (compare)

  • Jan 26 00:51
    gambiteer commented #651
  • Jan 26 00:41
    gambiteer commented #651
  • Jan 25 15:46
    antoine-doucet synchronize #651
  • Jan 25 15:33
    antoine-doucet commented #651
Drew Crampsie
@drewc
(eval '(begin
        (##namespace ("c#"))
        (##include "~~/lib/header.scm")))
Bradley Lucier
@gambiteer

This seems to work

heine:~/programs/gambit/gambit> gsi -:=. gsc/igsc.scm 
loading "~~/gsc/_host.scm"
loading "~~/gsc/_utils.scm"
loading "~~/gsc/_source.scm"
loading "~~/gsc/_parms.scm"
loading "~~/gsc/_env.scm"
loading "~~/gsc/_ptree1.scm"
loading "~~/gsc/_ptree2.scm"
loading "~~/gsc/_gvm.scm"
loading "~~/gsc/_back.scm"
loading "~~/gsc/_front.scm"
loading "~~/gsc/_prims.scm"
loading "~~/gsc/_assert.scm"
loading "~~/gsc/_asm.scm"
loading "~~/gsc/_x86.scm"
loading "~~/gsc/_arm.scm"
loading "~~/gsc/_riscv.scm"
loading "~~/gsc/_codegen.scm"
loading "~~/gsc/_t-univ-1.scm"
loading "~~/gsc/_t-univ-2.scm"
loading "~~/gsc/_t-univ-3.scm"
loading "~~/gsc/_t-univ-4.scm"
loading "~~/gsc/_t-cpu-abstract-machine.scm"
loading "~~/gsc/_t-cpu-primitives.scm"
loading "~~/gsc/_t-cpu-object-desc.scm"
loading "~~/gsc/_t-cpu-utils.scm"
loading "~~/gsc/_t-cpu-backend-x86.scm"
loading "~~/gsc/_t-cpu-backend-arm.scm"
loading "~~/gsc/_t-cpu-backend-riscv.scm"
loading "~~/gsc/_t-cpu.scm"
loading "~~/gsc/_t-c-1.scm"
loading "~~/gsc/_t-c-3.scm"
loading "~~/gsc/_t-c-2.scm"
loading "~~/gsc/_gsclib.scm"
loading "~~/gsc/_gsc.scm"
loading "~~/gsc/_gscdebug.scm"
Gambit v4.9.3-1234-g6acd87df

>  (compile-file "c.scm")
"/home/lucier/programs/gambit/gambit/c.o1"

This is in the Gambit source directory after a build.

luca regini
@lucaregini
thanks @gambiteer this works also for me.
Bradley Lucier
@gambiteer
I'm curious: What will you do with the interpreted compiler?
luca regini
@lucaregini
I want to study the compiler internals and document them as far as I can. This is something that I wanted to do for quite some time. Being able to step into the code helps considerably.
Bradley Lucier
@gambiteer
Cool.
Guillaume Cartier
@gcartier
I have built Gambit on Windows 10 using mingw-w64 using the Mingw-builds installer and choosing architecture: x86_64, threads: posix, exception: seh (mimicking the configuration used by Marc in Gambit’s appveyor.yml) and all seems to work but I get quite frequent access violation crashes that all point to longjmp. Any idea anyone? Any trail would be helpful I have no idea where to go
Guillaume Cartier
@gcartier
Addendum: I just saw the commit: "Use gcc __builtin_setjmp when available” on Jun 13 2020 that seems to be exactly the fix for the crashes I encounter. I will try and build using the latest Gambit and see if it fixes my crashes. Will report the results :)
François-René Rideau
@fare
:hamster: Gerbil Scheme
♞ Gambit Scheme
Guillaume Cartier
@gcartier
With the commit "Use gcc __builtin_setjmp when available” I now have both the Mac and Windows crashing. I ended up fixing the crashes by building Gambit with —enable-cpluscplus
Erkin B Altunbaş
@erkin
Hello
Can you update the README file in the repo with the latest supported SRFIs?
Right now Gambit column on the SRFI support table is incomplete because it relies on files in libs/srfi instead, which aren't present in the last tagged version.
It would be much easier to parse README for both head and tagged versions.
Erkin B Altunbaş
@erkin
I manually added details for Gambit for the time being.
Marc Feeley
@feeley

@erkin The SRFIs that are builtin are in the list returned by the R7RS procedurefeatures:

SRFI-0 SRFI-4 SRFI-6 SRFI-8 SRFI-9 SRFI-16 SRFI-18 SRFI-21 SRFI-22 SRFI-23 SRFI-27 SRFI-30 SRFI-39 SRFI-88

Gambit has some additional SRFIs implemented as modules that can be imported with import:

(import (srfi 28))  ;; Basic Format Strings
(import (srfi 41))  ;; Streams.
(import (srfi 64))  ;; A Scheme API for test suites
(import (srfi 69))  ;; Basic hash tables
(import (srfi 132)) ;; Sort Libraries
(import (srfi 158)) ;; Generators and Accumulators

I’ll look into how best to add that information to Gambit’s README.

Erkin B Altunbaş
@erkin
Thanks!
Currently, the scraper misses 16, 30 and 88.
James Baker
@eval-apply
Did anyone decipher why Gambit is producing erratic segfaults while doing a make modules? Seems to compile without issue using clang 10.0.1 albeit painfully slow but failing via gcc 8.3.0
Bradley Lucier
@gambiteer
Is it true in all Gambit back-ends that a valid vector index is a fixnum?
Marc Feeley
@feeley
@gambiteer yes
Vincent Toups
@VincentToups
Gambit on Arch comes with a bunch of gambcomp-* scripts. Are they documented anywhere? Are these official ways to use the compiler?
I'm pretty interested in trying out the javascript compiler but I have had trouble finding docs
Drew Crampsie
@drewc
But, as for "docs", -target js is all that's really needed
amirouche
@amirouche
@VincentToups look into https://github.com/pre-srfi/webui/
amirouche
@amirouche
The documentation is not up-to-date
Bradley Lucier
@gambiteer

I have a question about style: I'm trying to use case-lambda and error checking in a reasonable way, and I came up with

(define vector->array
  (let ()
    (define (five-args vec interval storage-class mutable? safe?)
      (if (not (boolean? safe?))
          (error "raw-vector->array: The fifth argument is not a boolean: "
                 vec interval storage-class mutable? safe?)
          (four-args vec interval storage-class mutable? safe?)))
    (define (four-args vec interval storage-class mutable? safe?)
      (if (not (boolean? mutable?))
          (error "raw-vector->array: The fourth argument is not a boolean: "
                 vec interval storage-class mutable?)
          (three-args vec interval storage-class mutable? safe?)))
    (define (three-args vec interval storage-class mutable? safe?)
      (if (not (storage-class? storage-class))
          (error "raw-vector->array: The third argument is not a storage-class: "
                 vec interval storage-class)
          (two-args vec interval storage-class mutable? safe?)))
    (define (two-args vec interval storage-class mutable? safe?)
      (if (not (interval? interval))
          (error "raw-vector->array: The second argument is not an interval: "
                 vec interval)
          (let ((indexer (%%interval->basic-indexer interval))
                (body-length (storage-class-length storage-class))
                (body? (storage-class-body? storage-class)))
            (cond ((not (body? vec))
                   (error "raw-vector->array: The first argument is not suitable for a body of the given storage-class: "
                          vec interval storage-class))
                  ((not (= (body-length vec) (interval-volume interval)))
                   (error "vector->array: The length of the first argument is not equal to the volume of the second: "
                          vec interval))
                  (else
                   (%%finish-specialized-array interval
                                               storage-class
                                               vec
                                               indexer
                                               mutable?
                                               safe?))))))
    (case-lambda
     ((vec interval)
      (two-args vec interval generic-storage-class (specialized-array-default-mutable?) (specialized-array-default-safe?)))
     ((vec interval storage-class)
      (three-args vec interval storage-class (specialized-array-default-mutable?) (specialized-array-default-safe?)))
     ((vec interval storage-class mutable?)
      (four-args vec interval storage-class mutable? (specialized-array-default-safe?)))
     ((vec interval storage-class mutable? safe?)
      (five-args vec interval storage-class mutable? safe?)))))

Is this reasonable? What do others do?

Rabia Alhaffar
@Rabios
Hiiiiiiiiiiiiiiiiiiiiii!
Thanks for gambit scheme!
junkerjoe
@junkerjoe
Are there plans for the Gambit website to start using HTTPS?
Drew Crampsie
@drewc
I've been using -target js a lot, and have hacked on the g_scm2host and friends.
(js#jso
 name: "ButtonCounter"
 data: (lambda _ (js#jso count: 0))
 render:
 (js#function (createElement)
  (createElement
   "button"
   (js#jso
    on: (js#jso
         click: (lambda _ (js#++ (js#ref js#this count:)))))
   (##string-append "Scheme Render?: You clicked me "
                    (##number->string (js#ref js#this count:)) " times"))))
That is a javascript object that becomes a Vue.js component that renders itself ala https://vuejs.org/v2/guide/render-function.html
if you look at the tests here, the "Scheme Render?" button is just that. https://drewc.github.io/gx-quasar/
Have a peek at the logs, in specific number 3, to see how that's possible, and my last few weeks of Gerbil->Gambit->JavaScript fun are there as well :)
Thank you so very much for making it possible!
Drew Crampsie
@drewc
That scheme comes out in the browser almost identical to this JS:
{
  name: 'ButtonCounter',
  data: function () {
    return {
      count: 0
    }
  },
  render: function (createElement) {
    return createElement(
      'button',
      {
        on: {
          click: () => { this.count++ }
        }
      },
        'Render: You clicked me ' + this.count + ' times.');
  }
}
Vincent Toups
@VincentToups
Hey @drewc I'm very interested in this code - is it available anywhere?
In the meantime is it sufficient to wrap scheme functions in g_scm2host to make them ok JS functions?
(This doesn't seem to work but I'm new with the js target)
Drew Crampsie
@drewc
@VincentToups the code is all in https://github.com/drewc/gx-quasar/ . Have a look at the gx/ directory. They are all gerbil files, not gambit, but close to the same.
I'd say "it all depends". At the same time, I think there's a flaw (that I'll likely mail about and patch and/or wait until someone tells me) in how objects are handled, so I made some hacks/patches here: https://github.com/drewc/gx-quasar/blob/main/gx/gxjs-fixes.ss
the long/short of it is that I made g_scm2host and g_host2scm treat JS objects as foreign, and foreign objects as data wrappers/pointers, which is what they are really.
The issue before was that it tried to turn any object into an alist.
Drew Crampsie
@drewc
I develop webapps in the browser. 80% of the objects I want to pass refer to themselves somewhere in their chain.
That infinite recursion plays well in the scheme stack (uses all of one core!) and blows the JS stack. :)