On Tue, May 17, 2011 at 9:04 AM, Chas Emerick <cemer...@snowtide.com> wrote:
>
> On May 17, 2011, at 4:57 AM, Ken Wesson wrote:
>
>> * There's no easy way to restart a REPL or close one; one must close
>> the REPL tab and also find and kill a java process using ps/kill or
>> Windows Task Manager or whatever tool, depending on OS.
>
> Cleaning up a REPL involves closing the REPL interaction view, and then 
> stopping the corresponding JVM process via its console (which will be brought 
> to the front if you click the corresponding button in the REPL view — which 
> oddly does not have the right icon in the latest 0.2.1 release…).
>
> Note that there are two views because there are 2+ things to manage: the JVM 
> process, and N REPL sessions you have to that JVM.  We'll probably add a 
> button to the REPL view itself for sessions connected to VMs started 
> explicitly for REPL interaction (vs. sessions that are connected to an 
> arbitrary network REPL) to close the REPL view and kill the corresponding 
> process in one action.

Thanks.

So, it can manage multiple REPLs on the same JVM? If one hangs (e.g.
an infinite loop) is there a way to start a second REPL on that JVM,
then get some kind of handle on the hung thread and kill it with
Thread.stop()? That would lead to a greater capability for session
recovery than what Enclojure currently seems to have.

>> * There seems to be no right click menu option to (re)load a source
>> file (either from the open file in the editor, or from the file's
>> listing in the package explorer) in an open REPL. Run... will start a
>> new REPL for each file/reload; to (re)load in an existing REPL seems
>> to require select all, copy, paste, enter, which will clutter up the
>> REPL history with (possibly very long) blocks of code. Drag and drop
>> from editor to either pane of REPL does not accomplish anything
>> either.
>
> You certainly can load sources from open editors with one keystroke -- the 
> default is Ctrl-L (maybe Cmd-L on Macs).  The contextual menu item (if you 
> right-click in the editor itself) is under Clojure > Load File in REPL 
> (you'll see the current keybinding for your environment there as well).  
> There are also shortcuts for loading only the current top-level expression, 
> and switching to the current file's namespace in the current REPL.

Ooh! Missed that, somehow. I think because it's buried in a submenu,
and not the same one (Run As) where the REPL can be launched.
Enclojure added most of these to the top level of the right click menu
in .clj edit panes, by contrast.

Good, good. I see some nifty stuff here like evaluate top level sexp
under the cursor and run tests in REPL, as well as load and change to
file N/S which I used frequently from Enclojure.

>> * No separate option to start a project-classpath'd REPL without
>> loading any files initially.
>
> Not true. Right click a project's icon in either the Package Explorer or 
> Project Explorer views, and you'll find a Run As > Clojure Application menu 
> item that will start a VM and connect a REPL to it.  This is roughly the only 
> way I ever start REPLs (I dislike having run configurations set up that 
> automatically load files on startup, etc).

Ah. I thought that attempted to build and run an AOT-compiled Clojure
project with a -main function. "Clojure Application" suggests that.
"Clojure REPL" might be better text for that menu option. Also in the
single-file Run As menu that loads the file.

>> * Namespace Browser is nifty, appearing to introspect on the open REPL
>> to maintain a set of defined symbols; similarly, autocomplete "sees"
>> your REPL-defined functions and vars. However, it won't update if a
>> var is redef'd with changed metadata; e.g. if you define a function
>> without a docstring, then redefine it with a docstring, the docstring
>> won't get added to the tooltip for its symbol in the Namespace
>> Browser. In fact, under some circumstances (I'm not sure what), it
>> won't update promptly to reflect a new function definition at all.
>> Oddly, it will update eventually but I'm not sure what triggers it. On
>> the other hand, it has a handy incremental search box at the top.
>
> I believe the namespace browser currently only updates on a focus change.  
> Perhaps not ideal, but we also don't want to constantly be polling the 
> process for namespace info either…

So it's a "pull" model, rather than a "push". The ideal architecture
would be a "push" one, where you hooked into the REPL process to get
notification pushed to the namespace browser functionality on any
change to any namespace. In principle, if you could get into the guts
of the namespace's mappings and add a watch to it with add-watch ...
but that might not be possible without modifying
clojure.lang.Namespace's Java source.

>> * Editor doesn't seem to have an option to reindent a block of code;
>> going line by line and hitting tab seems to be the only method
>> provided, short of fully-manual reindentation.
>
> This is a much-requested item, and I think is blocked by some of the 
> underlying parser bits.  The issue to watch: 
> http://code.google.com/p/counterclockwise/issues/detail?id=139

Yes. I tried making a block selection and hitting tab, but it just
indents everything by whatever amount it indents the first line,
putting the first line in the correct position but possibly not the
rest depending on what changes were made.

Unfortunately, this is a fairly awkward problem, as I frequently have
to reindent after rearranging the structure of some code.

> This is very easy to set up.

If it were, I would presumably have managed to do so without outside
help. Clearly it is not as easy as it seems to someone who already
knows exactly how.

> The Java > Installed JREs panel in the Eclipse preferences is wanting JDK 
> home directories, not /bin directories or any other.

The parent directory also generated an error when I tried it.

> You can set -server (or any other VM argument) for any REPL configuration by 
> going to the Run > Run Configurations menu item.  In the Run Configurations 
> window, you'll see all of the configs associated with REPLs you've started in 
> the past;

I looked there, and it was empty. Are we perhaps not using exactly the
same version? My Eclipse reports itself as Helios Service Release 1.
There doesn't seem to be a way to get CCW's version reported, short
perhaps of triggering an attempt to update it, but I think it's
0.2.something.

clicking on any of them will allow you to modify command line args, VM
args, make manual modifications to the classpath used only for that
configuration, and so on.  This is one reason why I always start my
REPLs from the project itself -- I know I'll be re-running the REPL
configuration for the project, on which I'll have already set -server,
a better heap, etc.  If I were to use a random file load as the
trigger for starting new REPLs, then I wouldn't be sure as to what
sort of VM configuration I'd be getting.

So the REPL has to be started from the project to get its VM
configuration to appear in Run Configurations?

> No, this sort of side-by-side is great.  Hopefully the above points address 
> some of the perceived deficiencies.

They do; thank you. The main things still bothering me are:

1. Lack of multi-line reformat indents.

2. Enter in the middle of a REPL submission breaks the line even if
the sexp lacks unmatched delims, unlike Enclojure. Sometimes handy,
sometimes annoying to someone used to being able to edit something in
the middle of the line (e.g. a number), hit enter, and thus quickly
try a function with several parameters. One has to tap end (or
ctrl-end, if not on the last line) before enter in CCW's REPL. This is
more a matter of "takes some getting used to" than a bug; it's just a
difference (and it may be responsible on the Enclojure side for the
premature submission when the [s are unbalanced).

3. A few things seem a bit less self-evident without looking at either
Eclipse or CCW documentation than is the case with NB/Enclojure,
including (sorry to harp on this) the install's extra step and the
behavior of some of the other things.

> One thing to keep in mind: both CCW and Enclojure try pretty hard to be good 
> citizens on the Eclipse and Netbeans platforms, respectively.  That means 
> that (in CCW) rather than having a top-level Clojure item in projects' 
> contextual menus, you'll find the start-a-REPL action as an item in the Run 
> As… submenu, and REPL configurations end up being just a slight twist on 
> standard Java application run configurations instead of being elevated into 
> an area that might be easier to find.
>
> These sorts of things should be natural for someone that knows Eclipse, but I 
> can absolutely see how it could make things difficult if you're running 
> Eclipse only to use CCW and Clojure.  I don't have any good UI ideas at the 
> moment to address that without really running afoul of Eclipse norms.

That's okay. I think the best option is to provide a quick-start guide
and an easy way to get users to discover and view it during/right
after CCW install. I do have prior Eclipse experience, though not for
a couple of years.

> That said, I think a couple of short screencasts that do a feature 
> walkthrough would probably resolve 90% of the where-can-find-X problem.

Text documentation w/screenshots will suffice. ;) Though you can go
ahead and do both. If there's a Marketplace feature that can be used
to attach a readme.html type of thing to an installable add-on ... or
perhaps CCW could add a CCW item or submenu to the Help menu?
Actually, now that I check, the main Help Contents *does* seem to
contain a CCW section after CCW is installed, but this fact is not
obvious if you don't go looking for it. A direct link to it in the
Help menu would make that clearer. (Disturbingly, accessing the Help
also seems to start up a web server on the machine, though according
to my firewall software it never asked for an Internet-visible network
socket -- I didn't even know it was possible to open a listen socket
that would only be visible via loopback interface even without any
firewall? Low level networking not being my area of expertise, which
as you might have guessed from my other posts is algorithms and data
structures instead. It looks from this like there's no security risk
created by the server, but it does make the help open rather
s.l.o.w.l.y. :) Now that I think of it, though, the obvious way for
the REPLs to talk to the IDEs is via loopback socket too, and none of
those have triggered firewall alerts about applications trying to open
Internet-visible listen ports either.)

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to