Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    salotz
    @salotz
    0.16 gerbil
    Jaime Fournier
    @ober
    so only issue is when using--with-gambit. ok odd. I've never used that option, and let PATH do its thing
    salotz
    @salotz
    I mean I'm definitely overcomplicating things just to try and put less things on PATH for Gambit exes
    But I also want to make sure I'm pointnig gerbil at a version of gambit that its supposed to be with, rather than the one that is Gambit/current
    definitely its when you set --bindir, --libdir, and --includedir to things other than the gambit HOME
    salotz
    @salotz
    also the docs has the wrong flag for specifying gambit in configure
    salotz
    @salotz
    so gerbil just needs the gambit binaries? does it need the library and header files?
    Jaime Fournier
    @ober
    it just needs what is installed. not the source repository
    Jaime Fournier
    @ober
    @salotz can you open an issue for the behavior you see above?
    salotz
    @salotz

    it just needs what is installed. not the source repository

    understood, but specifically what? does it need libs and headers in addition to gsc/gsi? Making issue

    Jaime Fournier
    @ober
    given it has to invoke gsc/gsi there are libraries and headers afaik, since it has to compile the C
    salotz
    @salotz
    right, makes sense :P if I'm reading the configure script right its taking the prefix from --with-gambit and adding /bin/gsc to the end of that. So when I had /usr/local/bin/gsc I tried --with-gambit=/usr/local/bin which doesn't make sense then
    (define (gambit-gsc-path)
      (if gambit-prefix
        (string-append gambit-prefix "/bin/gsc")
        "gsc"))
    salotz
    @salotz
    François-René Rideau
    @fare
    is letrec* doing what I think it does, or can it reorder stuff? Because it looks to me like it reorders stuff in some cases I don't understand, which would explain some funky behavior I see.
    François-René Rideau
    @fare
    looks like I have isolated an example of def doing the wrong thing. I'll try to minimize it at some point, but at least it's reproducible.
    ("wrong" might be my mental model, but then I'm not sure I want to use it if the spec doesn't match said mental model)
    François-René Rideau
    @fare
    I could detach the example from most of my code, but it's still far from minimal. Definite reordering of definitions that is not letrec* like.
    François-René Rideau
    @fare
    package: "bug"
    
    ":" ; ( echo -e '\n\nINTERPRETED\n\n' ; gxi reordered.ss; echo -e '\n\nCOMPILED\n\n' ;  gxc -O reordered.ss && gxi -e '(import :bug/reordered)' ) 2>&1 | less
    
    (def (reordered)
      (displayln 100)
      (def x (begin (displayln 200) 42))
      (displayln 300)
      (displayln 400 [x])
      (displayln 500)
      (def y (begin (displayln 600) 23))
      (displayln 700 [y]))
    
    (reordered)
    line 400 is moved until after lines 500 and 600.
    François-René Rideau
    @fare
    I took the output of gerbil, which uses gambit's letrec*, and reported a bug on the gambit channel.
    Drew Crampsie
    @drewc
    Amaratto involved, so not yet trying it, but: letrec* = letrec + letrec ad infinitum, non? So we can hack in for now in gx-gambc# or some such?
    Oh, there has to be some set!'s involved doesn't there ....
    drewc @drewc searches for /delete lol
    drewc @drewc should likely read the spec before thinking out "loud"
    drewc @drewc blames Amaretto which he misspelled :P
    Ricardo Lanziano
    @arpunk

    @lambdanon_twitter maybe you can package Gerbil for GUIX? You could use the Nix recipes as reference.

    @lambdanon_twitter I have a personal guix channel with both gambit and gerbil (full) that I use. I could send you the build recipes when I get back home if you still need them.

    (Sadly I don't have the files published yet)
    salotz
    @salotz
    @arpunk I would be interested in that, no rush though
    if you do get around to posting them ping us here :)
    rvs314
    @rvs314
    Can someone help me get the relationship between packages, modules and namespaces?
    I'm trying to write a library which may shadow some builtins and think I should use a namespace for it, but I'm not sure how
    Jaime Fournier
    @ober
    I've not seen namespaces used as such, but renaming is most often what I have to do to avoid conflicts
    (import (rename-in :gerbil/gambit/os (current-time builtin-current-time)))
    λ(ηøη) ☭
    @lambdanon_twitter
    @lambdanon_twitter maybe you can package Gerbil for GUIX? You could use the Nix recipes as reference.
    I was just about to get started on this, and then realized i better check if its already packaged for guix, and voila, its already there
    François-René Rideau
    @fare
    Nice! Who made it? Is it up-to-date?
    Drew Crampsie
    @drewc
    @rvs314 "namespaces" are simply a prefix to the symbol. In other words, a symbol named "foo#bar" is known as "bar" in the "foo" namespace. Gambit has a way to specify "for these symbols, or all unbound symbols, use the namespace prefix when referencing that symbol". So, after READ but before EVAL, (bar "baz") becomes (foo#bar "baz").
    try gxc -staticor have a look in ~/.gerbil/lib/static/ to see the .scm files that Gerbil outputs to the Gambit compiler, as they are also the "step" between "namespaces" and "packages".
    Drew Crampsie
    @drewc
    "packages" are just a way to say "use this namespace for this file based on this package".
    In other words, if the file is named "foo" and in the "baz" package, symbols will be defined in the "baz/foo" namespace
    ie:
    [drewc@nyx:/tmp]$ echo package: baz > foo.ss
    
    [drewc@nyx:/tmp]$ echo "(def (foo bar) (cons bar 'baz))" >> foo.ss
    [drewc@nyx:/tmp]$ gxc -static -d . -v ./foo.ss 
    compile ./foo.ss
    compile baz/foo
    compile ./baz/foo__0.scm
    invoke gsc (gsc -:i8,f8,-8,t8 ./baz/foo__0.scm)
    copy static module ./baz/foo__0.scm => ./static/baz__foo.scm
    compile ./baz/foo__rt.scm
    invoke gsc (gsc -:i8,f8,-8,t8 ./baz/foo__rt.scm)
    compile ./baz/foo.ssi
    
    [drewc@nyx:/tmp]$ ls static/
    baz__foo.scm
    
    [drewc@nyx:/tmp]$ cat static/baz__foo.scm 
    (declare (block) (standard-bindings) (extended-bindings))
    (define baz/foo#foo (lambda (_bar388_) (cons _bar388_ 'baz)))
    Drew Crampsie
    @drewc
    Now, as for "modules", there are so many different kinds with different formats and ways of dealing with them, BUT, assuming we are talking about basic Gerbil here lol, by default, ":baz/foo" also becomes the module name. So I can use that to tell Gerbil that this namespace and this module work in such a way that import becomes a namespace reader.
    ie:
    Drew Crampsie
    @drewc
    # First add :baz/foo to the global library 
    [drewc@nyx:/tmp]$ gxc -static -v ./foo.ss 
    # [...]
    compile ~/.gerbil/lib/baz/foo.ssi
    
    [drewc@nyx:/tmp]$ echo package: baz > bar.ss
    [drewc@nyx:/tmp]$ echo '(import (only-in :baz/foo foo))' >> bar.ss
    [drewc@nyx:/tmp]$ echo '(def (qwerty uiop) (foo uiop))' >> bar.ss
    
    [drewc@nyx:/tmp]$ gxc -static -d . -v -S ./bar.ss 
    #[...]
    copy static module ./baz/bar__0.scm => ./static/baz__bar.scm
    
    [drewc@nyx:/tmp]$ ls static/
    baz__bar.scm  baz__foo.scm
    
    [drewc@nyx:/tmp]$ cat static/baz__bar.scm 
    (declare (block) (standard-bindings) (extended-bindings))
    (define baz/bar#qwerty (lambda (_uiop388_) (baz/foo#foo _uiop388_)))
    Also important to note is that the bar and uiop arguments became a gensym'd thingie. This avoids conflicts of course, and goes along with "symbols are not what they appear".
    So an expander-module is basically Gerbil's way of saying "map this symbol to this namespace before expanding on it". We can actually change the namespace, and the package, a number of ways, but by default it is "<package>/<filename" that becomes the module name and the namespace.
    Drew Crampsie
    @drewc
    There are submodules, and a bunch of other jazz, but by a quick look at your request: You do not need to think about namespaces. Just make your file a Gerbil module in your package and import/shadow/rename/whatever with the symbols. The compiler takes care of the rest.
    Note: none of the symbols I typed ended up in the .scm file. def => define, qwerty => baz/bar#qwerty, foo => baz/foo#foo, bar => _bar388_ and uiop => _uiop388_. So, while namespaces are certainly involved, I did not have to care about them in the least. Gerbil is a meta-dialect on top of ol' Scheme :P