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

Add :std/swank, some swank instructions and functions in the readme, and gxswank/gerbil swank #1186

Open
wants to merge 28 commits into
base: master
Choose a base branch
from

Conversation

drewc
Copy link
Collaborator

@drewc drewc commented Mar 22, 2024

No description provided.

Copy link

netlify bot commented Mar 22, 2024

Deploy Preview for elastic-ritchie-8f47f9 ready!

Name Link
🔨 Latest commit f91e035
🔍 Latest deploy log https://app.netlify.com/sites/elastic-ritchie-8f47f9/deploys/664aa20abe70b20008ef9704
😎 Deploy Preview https://deploy-preview-1186--elastic-ritchie-8f47f9.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Comment on lines 12 to 17
#+begin_src sh
gxi -:te \
-e '(import (prefix-in (only-in :std/swank create-server) swank#))'\
-e '(swank#create-server port: 4015)'\
-
#+end_src
Copy link
Collaborator

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.

Comment on lines 26 to 45
#+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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove?

@drewc drewc changed the title Add new draft for :std/swank [WIP] Add new draft for :std/swank Mar 27, 2024
@vyzo
Copy link
Collaborator

vyzo commented Apr 12, 2024

please dont change interface internals willy nilly.

@vyzo
Copy link
Collaborator

vyzo commented Apr 12, 2024

specifically, this pr should make no changes in core.

Ehat you are doing with the specializer seems very wrong.

Copy link
Collaborator

@vyzo vyzo left a 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.

@drewc drewc requested a review from vyzo April 23, 2024 00:05
@drewc drewc marked this pull request as ready for review April 23, 2024 00:05
@drewc drewc changed the title [WIP] Add new draft for :std/swank Add :std/swank, some swank instructions and functions in the readme, and gxswank/gerbil swank Apr 23, 2024
@drewc drewc force-pushed the swank branch 2 times, most recently from c42bf5b to a75af08 Compare April 23, 2024 02:40
Copy link
Collaborator

@vyzo vyzo left a 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.
Copy link
Collaborator

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.

Comment on lines +2 to +11
: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)
Copy link
Collaborator

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)
Copy link
Collaborator

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)))
Copy link
Collaborator

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.

Comment on lines +16 to +17
(##string-upcase (string-trim-eol
(cdr (##shell-command "uname -m" #t)))))
Copy link
Collaborator

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.

Comment on lines +62 to +65
(extern namespace: #f
swank:lookup-presented-object
swank:lookup-presented-object-or-lose
swank:get-presented-object)
Copy link
Collaborator

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
Copy link
Collaborator

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))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hash...

Comment on lines +28 to +34
(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)))))))
Copy link
Collaborator

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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why?

Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants