-
Notifications
You must be signed in to change notification settings - Fork 110
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
Add :std/swank, some swank instructions and functions in the readme, and gxswank/gerbil swank
#1186
base: master
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for elastic-ritchie-8f47f9 ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
src/std/swank/README.org
Outdated
#+begin_src sh | ||
gxi -:te \ | ||
-e '(import (prefix-in (only-in :std/swank create-server) swank#))'\ | ||
-e '(swank#create-server port: 4015)'\ | ||
- | ||
#+end_src |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this needs to become gerbil swank -p 4015
!
Also, document in the guide.
src/std/swank/README.org
Outdated
#+begin_src scheme :shebang #!/usr/bin/env gxi | ||
;; -*- Gerbil -*- | ||
|
||
(import :std/build-script) | ||
|
||
(defbuild-script | ||
'("swank/api" | ||
"swank/message" | ||
"swank/context" | ||
"swank/autodoc" | ||
"swank/presentation" | ||
"swank/top" | ||
"swank/eval" | ||
"swank/completions" | ||
"swank/handlers" | ||
"swank/server" | ||
"swank" | ||
) | ||
verbose: 10) | ||
#+end_src |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove?
please dont change interface internals willy nilly. |
specifically, this pr should make no changes in core. Ehat you are doing with the specializer seems very wrong. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please dint change internals like that.
gerbil swank
c42bf5b
to
a75af08
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still very raw and needs cleanup.
Structurally however, it is ok, which what matters.
Some cleanup advise:
- don't use directly namespaced things (gx#, gxc#); import the right modules so that you don't have runtime surprises
- don't use
##
stuff unnecessarily, they are there only if you need them and most of the times here you don't - use hash-tables instead of raw tables, these are hidden from view now.
- there is a .lisp file, wtf?
- use relative imports in package.
As of Gerbil v0.19, both names are supported. | ||
Up to and including Gerbil v0.19, both names are supported. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
haha yeah, v0.19 has not been released yet.
:std/swank/api | ||
:std/swank/message | ||
:std/swank/context | ||
:std/swank/presentation | ||
:std/swank/eval | ||
:std/swank/top | ||
:std/swank/completions | ||
:std/swank/autodoc | ||
:std/swank/handlers | ||
:std/swank/server) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use relative imports here, as it is the package:
(import ./swank/api ...)
(def current-slime-id (make-parameter #f)) | ||
(def current-swank-exit-emacs-rex (make-parameter #f)) | ||
(def (swank-machine:version) | ||
(with ([cpu os kern] ##os-system-type-saved) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's such a hack, can't you avoid the ##os-system-type-saved
?
(with ([cpu os kern] ##os-system-type-saved) | ||
(if (eq? os 'apple) | ||
(string-trim-eol | ||
(cdr (##shell-command "sysctl -n machdep.cpu.brand_string" #t))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just (shell-command...)
no need to use the unchecked version.
(##string-upcase (string-trim-eol | ||
(cdr (##shell-command "uname -m" #t))))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again, no need for the ##
's here.
(extern namespace: #f | ||
swank:lookup-presented-object | ||
swank:lookup-presented-object-or-lose | ||
swank:get-presented-object) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
???
@@ -0,0 +1,60 @@ | |||
(import :std/swank/api :std/swank/message |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.lisp????
|
||
;;; client->thread mapping | ||
(def repl-thread-client-table | ||
(##make-table weak-keys: #t)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hash...
(while #t | ||
(try | ||
(using (cli (sock.accept) : StreamSocket) | ||
(debugf "Accepted connection from ~a" (cli.peer-address)) | ||
(spawn swank-handle-slime cli)) | ||
(catch (e) | ||
(errorf "Error accepting connection: ~a" e))))))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this won't be able to ever shutdown.
dont-close: (equal? "true" .dont-close)))) | ||
|
||
(thread-yield!) | ||
(##repl) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the ##repl
i mean you can just thread-join!
the server thread.
No description provided.