Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GNU Guile Scheme REPL not showing output #412

Open
francium opened this issue Sep 11, 2022 · 8 comments
Open

GNU Guile Scheme REPL not showing output #412

francium opened this issue Sep 11, 2022 · 8 comments
Labels
bug Something isn't working client-scheme

Comments

@francium
Copy link

francium commented Sep 11, 2022

I'm trying to do some very simple Scheme REPL work.

I've got a very simple config and almost everything is working except for,

(display "Hello, World!")

Which is just giving me, when I do <leader>ee,

; --------------------------------------------------------------------------------
; eval (current-form): (display "Hello, World!")
; Empty result

Here's my relevant config,

Plug 'https://github.com/Olical/conjure'
let g:conjure#filetype#scheme = "conjure.client.guile.socket"
let g:conjure#client#guile#socket#pipename = ".guile-repl.socket"

And the script for creating the REPL and socket,

#!/usr/bin/env bash

SOCKET=$(git rev-parse --show-toplevel 2> /dev/null || pwd)/.guile-repl.socket

echo "$(tput bold)$SOCKET$(tput sgr0)"

if [ -f $SOCKET ]; then rm $SOCKET; fi
guile --listen=$SOCKET

rm $SOCKET

In the guile command line REPL, I get the expected result,

scheme@(guile-user)> (display "Hello, World!")
Hello, World!scheme@(guile-user)> 

Contrast this with ConjureSchool,

  (print "Hello, World!")

Here doing <leader>ee on this form results in,

; --------------------------------------------------------------------------------
; eval (current-form): (print "Hello, World!")
; (out) Hello, World!
nil

The (out) Hello, World! as expected.

So is this perhaps a GNU Guile limitation?

I'm very new to Lisp, Scheme, Guile and Conjure, so hopefully I'm not making some very obvious novice mistake. If I am please let me know.

@Olical
Copy link
Owner

Olical commented Sep 11, 2022

I think you need a newline at the end of the display call? Which isn't ideal, but that should work?

This is something that would probably be fixed by the future stdio client support rewrite.

@francium
Copy link
Author

So this right,

(display "Hello, World!\n")

Then <leader>ee gives,

; --------------------------------------------------------------------------------
; eval (current-form): (display "Hello, World!\n")
; Empty result

@francium
Copy link
Author

francium commented Sep 11, 2022

I tried out vim-slime with this config,

Plug 'https://github.com/jpalardy/vim-slime'
let g:slime_target = "tmux"
let g:slime_paste_file = tempname()

That was working without any issues, so may just be an issue with with stdio client in conjure as you mentioned.

So it's not too urgent for me. I can work with vim-slime for my very basic needs and use conjure if I play around with another Lisp at some point.

conjure is really great compared to vim-slimebtw based on my very brief experience using both.

@Olical Olical added bug Something isn't working client-scheme labels Sep 14, 2022
@Olical
Copy link
Owner

Olical commented Dec 1, 2023

Sorry it's been so long, someone on Mastodon just brought this to my attention again. Had a quick go at fixing it and it seems to work for me now. If someone else can confirm that I'll merge and close this 😄

It's on the develop branch.

@aleksandersumowski
Copy link

Seems to be fixed in develop! Thanks a lot! Saved from Emacs once again 😆

@Olical
Copy link
Owner

Olical commented Dec 1, 2023 via email

@austinmlv
Copy link
Contributor

With the current situation the following doesn't work as expected for me:

(define (print-hi-and-return x)
  (begin
    (display "Hi")
    (newline))
  x)

(print-hi-and-return 123)
;; The above returns:
123

If the Guile client were to behave similar to the client for built-in Fennel shouldn't it produce output in the log like the following:

; (out) Hi
123

At the Guile repl this happens:

scheme@(guile-user)> (print-hi-and-return 123)
Hi
$5 = 123
scheme@(guile-user)>

I have a possible fix with #552 but that may not be what people expect with the Guile client.
There's also the issue where:

(define (return-values)
  (values 123 "Hi"))

(return-values) 
;; Returns only:
123
;; Should be:
123
"Hi"

At the Guile repl:

scheme@(guile-user)> (return-values)
$9 = 123
$10 = "Hi"
scheme@(guile-user)>

I'm planning on working on a PR to address the second problem but that might be better dealt with in another issue.

@Olical
Copy link
Owner

Olical commented Feb 2, 2024

Merged the PR so that should address the print example given, the final multi-value return example still doesn't work though. We might need to do some wider refactoring to get that to work as expected, clearly we're missing something fundamental and a change in approach might make the behaviour flawless while simplifying the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working client-scheme
Projects
None yet
Development

No branches or pull requests

4 participants