unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Want suggestion on implementing collaborative repls and alikes
@ 2021-09-06  1:41 Qiantan Hong
  0 siblings, 0 replies; only message in thread
From: Qiantan Hong @ 2021-09-06  1:41 UTC (permalink / raw)
  To: Emacs Devel; +Cc: Stefan Monnier

Copied from a communication with my friends:

> Still, I haven’t done the work to make crdt.el work with
> xscheme.el and alike yet.
> In fact, I haven’t decide on the following two implementation strategy,
> and the choice *will affect UI behavior*:
> 
> 1) Proxy at command level: 
> When client invoke C-x C-e and alike, send the invoked Emacs command 
> directly to the server.
> 
> This strategy is easy to implement, but there’re hypothetically
> some issue during concurrent edit. E.g. user A might see
> (+ 1 1) in their buffer, and press C-x C-e.
> However, when the “C-x C-e” message arrives at the server, some
> other user might have changed it to (+ 1 1 1).
> The server will then just execute what’s in its buffer at the time
> of receiving the message, and writes ;Value 3
> 
> 2) Proxy at buffer process and buffer local variable level.
> The client execute the whole C-x C-e command locally, only
> when the code try to send to buffer process (which only exist on server)
> or modify some variables annotated to be synchronized,
> such operation are intercepted and sent to the server.
> 
> This doesn’t has the problem of 1, but is much more complicated
> and require adding lots of annotation in xscheme.el etc to work.
> Moreover, it’s hard to figure out the correct annotations to make
> the synchronization really correct.
> (1 doesn’t have this issue because we know it’s always incorrect! 
> but maybe not so incorrect to be unusable).

More detailed in HACKING.org on the development branch of crdt.el
under "Why we need used-state-set annotations”.
(web url https://code.librehq.com/qhong/crdt.el/-/blob/development/HACKING.org)
It writes about a way to resolve user intention problem for command-level strategy,
but add more complexity to this simple approach:
> The correct solution is to let the server roll-back to the state when Ben Bitdiddle invoked the command.
> It is relatively expensive thus we don't want to do this for every command,
> thus we require package hackers to annotate explicitly.
> 
> /The above mechanism haven't been implemented yet!/ 
> But adding annotations now will help adding it in the future.
> To implement this mechanism we need to add lamport timestamp to every messages 
> (which may corresponds to mutation of interesting states),
> and send a vector clock in =command= messages which depend on buffer content.

Many REPL like modes depends on the above strategies,
e.g. shell-mode eshell-mode and other comint-mode derivatives.

Any thoughts on which way to go? How far should we go?


Best,
Qiantan


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-06  1:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-06  1:41 Want suggestion on implementing collaborative repls and alikes Qiantan Hong

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).