cosmin / IClojure

A better Interactive REPL for Clojure
http://www.iclojure.com
Eclipse Public License 1.0
115 stars 11 forks source link

reflecting on an Integer causes a crash #1

Closed samaaron closed 12 years ago

samaaron commented 12 years ago
λ java -jar iclojure-1.0-SNAPSHOT.jar                                          
Clojure 1.4.0-alpha4                                                           

IClojure 1.0 -- an enhanced Interactive Clojure                                
?         -> Introduction and overview of IClojure's features                  
?symbol   -> Print documentation for symbol                                    
??symbol  -> Show source of function or macro                                  
%d symbol -> Describe Java class (show constructors, methods and fields)       

user[1]: (def d (Integer. 1))                                                  
user[1]= #'user/d                                                              

user[2]: %d                                                                    
Exception in thread "main" java.lang.RuntimeException: EOF while reading       
        at clojure.lang.Util.runtimeException(Util.java:170)                   
        at clojure.lang.LispReader.read(LispReader.java:165)                   
        at clojure.lang.RT.readString(RT.java:1691)                            
        at com.offbytwo.iclojure.Main.read(Main.java:109)                      
        at com.offbytwo.iclojure.Main.loop(Main.java:177)                      
        at com.offbytwo.iclojure.Main.main(Main.java:227)                      
samaaron commented 12 years ago

Ah ok, now as soon as I submit it - I see I'm not using this appropriately - but still, it probably shouldn't die like this :-)

cosmin commented 12 years ago

nice catch, I'll add some error handling to %d

cosmin commented 12 years ago

Try the latest version. Your comment got me thinking that a naked %d should just describe the last output (*1), so it will now do that by default, as well as handling the cases where the REPL is unable to read or evaluate the form after %d.