Comments (6)
Agreed. This is planned. First I need to define a protocol for the communication, then rewrite the readline client to use it. One of the other reasons for defining a protocol is because some things like auto-completion could then be added as protocol extensions. There is some complexity with long-running (and/or concurrent) operations that are producing output which needs to be sent over the network. Currently, because the output is simply sent to stdout, there's no need to handle that sort of thing.
from boris.
Cool. I really missed a REPL with PHP. SWANK is an RPC protocol. It would allow easy integration with Emacs for example. But maybe there is another protocol you might want to consider.
from boris.
here's another server/client thing for JS that does auto-completion and so on: http://ternjs.net/
from boris.
just so that you might be aware of it. there is already an Emacs mode to make the REPL work under Emacs: https://github.com/tomterl/php-boris
I wrote a minor mode that uses that to allow sending parts of a PHP buffer to the REPL in Emacs: https://github.com/steckerhalter/php-boris-minor-mode
It's already close to what you can do with Clojure and nrepl (https://github.com/clojure-emacs/nrepl.el).
So for the networking part... have you thought about the protocol to use?
Btw, there's also https://github.com/tailrecursion/wigwam, but it uses some readline functions that don't work on Debian/Ubuntu PHP. Maybe that can give some inspiration too...
from boris.
I did a quick hack to play with this idea and pushed it to https://github.com/joddie/boris/tree/completion-and-network-hacks. It's pretty rough still, but it works well enough for me to get context-aware completion while running Boris under Emacs when the included boris-completion.el is loaded. Completion also sort of works in a terminal, with minor annoyances, if PHP is compiled with GNU readline. It should be smart enough to complete the appropriate normal & static object members and array indexes at any level of nesting, as well as the usual constants/functions/classes/namespaces.
The socket protocol uses JSON messages preceded by 4 bytes giving the length of the data. It would definitely need some extra work to be reliable.
I should emphasise that this was just a hack to experiment with the idea, which may not match @d11wtq's future plans for boris. However, if there is interest in using part or all of it, I'm happy to try refactoring things.
from boris.
I have been hacking on a SLIME backend for PHP (https://github.com/steckerhalter/swank-php) and was using what @joddie already added to communicate with the REPL.
Only completion and documentation is available with his extensions so I'll be trying to add evaluation too.
Can someone else look at the code from Joddie too and see if this might be ok to proceed or not?
from boris.
Related Issues (20)
- Feature request: add dependencies to the readme HOT 1
- Broken backwards compatibility HOT 11
- Previous and next command with up and down arrow not working HOT 7
- Segmentation Fault HOT 11
- Bug: "use" and "::class" doesn't return the same class. HOT 2
- Undefined variable: boris in .borisrc HOT 1
- CTRL+U incorrect behaviour HOT 4
- Delete key produces tilde HOT 4
- Unicode characters were not accepted HOT 2
- Curly braces used for object property dereferencing cause parse error
- Demo URL is broken in readme file HOT 1
- Can not echo global variable HOT 1
- Packagist no longer has different version based of tags HOT 3
- HTTP Clients may fail silently
- SemVer breakage. HOT 1
- do/while loop doesn't work. HOT 1
- Composer >1.3.0 compatibility
- Support strict types.
- Redefine class/functions
- Demo link returns "Not Found"
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from boris.