News for hackers. Stuff that matters.
Re:SBCL: The Ultimate Assembly Code Breadboard by jgalt212 on Sunday March 16, 2014 @11:23AM (#7409708)
People love to go on and on about the power of macros, but for me, what separates Lisp from the crowd is that it's a compiled language with a REPL.

Are they any other usable compiled languages with a REPL?

Re:SBCL: The Ultimate Assembly Code Breadboard by jules on Sunday March 16, 2014 @12:01PM (#7409886)
Haskell, OCaml, Erlang, Scala, C#, C, C++ (!) and many others. This really doesn't set Lisp apart any more.
Re:SBCL: The Ultimate Assembly Code Breadboard by _delirium on Sunday March 16, 2014 @12:21PM (#7409981)
If by Haskell's REPL you mean GHCi, I think it probably qualifies, but it lacks one of the nicer features of a REPL, which is that you can type the same code interactively that you can load from a file. In fact that's how SLIME works with Lisp, by literally copying forms from a Lisp file into the interactive session. If you copy/paste Haskell code out of your .hs files into GHCi you get errors, because the syntax is slightly different, which I find a bit confusing & inconvenient.
Re:SBCL: The Ultimate Assembly Code Breadboard by anon_d on Sunday March 16, 2014 @01:24PM (#7410280)
Meh. You want to do imperative stuff in the repl, and you can't do that at the top-level in Haskell. The way ghci works is solid. When you are in the ghci repl, you are coding inside the do-notation for the IO monad.

Really, IMHO, jumping back and forth between the editor and the REPL with constant reloading is a better approach than pasting things into the REPL. I remember when I was playing with Common Lisp, I would always have trouble keeping the code on disk and the code loaded into the REPL synced.

Re:SBCL: The Ultimate Assembly Code Breadboard by emiljbs on Sunday March 16, 2014 @01:56PM (#7410413)
>I remember when I was playing with Common Lisp, I would always have trouble keeping the code on disk and the code loaded into the REPL synced.

Then you're doing it wrong. Most people doesn't type directly into the REPL, they open up a separate buffer in Emacs and play in that. The REPL is just for small tests. There is no such thing as 'keeping the code synced'.

Re:SBCL: The Ultimate Assembly Code Breadboard by vilhelm_s on Sunday March 16, 2014 @04:58PM (#7411250)
I don't know how you develop Lisp, but one style which seems encouraged by environments like SLIME is this: You write your file in emacs, and each time you finish a function definition you hit the "send definition to repl" keystroke, and then experiment a bit in the repl to see that you got it right.

If you do things this way, the state of the running lisp interpreter depends on the entire history of the coding session. Each time you add a new definition, you mutate the interpreter's memory. There is no guarantee that the current state matches what you would have if you recompiled the entire system from scratch.

On the other hand, the usual style in Haskell development is that you write a function definition and then hit the "reload" key combination, and this makes the state of the repl exactly the match the contents of the file. It throws away the results of any commands you ran in the repl in the meantime.

(This seems like an interesting cultural difference, something like "Haskell/ML/Java/Scheme programmers think of a program as a text, Common Lisp/Smalltalk programmers think of a program as an OS process").

Re:SBCL: The Ultimate Assembly Code Breadboard by lispm on Sunday March 16, 2014 @06:17PM (#7411641)
One does that in Lisp, too. But often we want to avoid that. Lisp programs are often written in such a way that interactive modification is painless. There are a few very large Lisp programs which would take too long to compile/load each time. Thus we learn to deal with changing running programs. A Lisp system is often like a big collection of objects.
Re:SBCL: The Ultimate Assembly Code Breadboard by anon_d on Sunday March 16, 2014 @02:31PM (#7410563)
That's how I was doing it. It's been too long to remember the details, but I remember that there are different phases when code is loaded, and it can get very tricky when you're doing heavy meta-programming stuff. Everything works when load your new definitions from a buffer into the repl, but when you try to load it again from a file, all the phase issues come into play.
Re:SBCL: The Ultimate Assembly Code Breadboard by ScottBurson on Sunday March 16, 2014 @11:07PM (#7412672)
Yes, there is some potential for confusion here. Usually the problems can be solved by appropriate use of EVAL-WHEN.
Re:SBCL: The Ultimate Assembly Code Breadboard by _delirium on Sunday March 16, 2014 @01:30PM (#7410314)
The main thing I use a REPL for is playing around with defining/redefining functions and then using them in various ways, and the different syntax plus the weird :{ :} business made that tedious in GHCi. So I ditched it and just moved to the old-school C-style "edit a file, save, compile, run" cycle.
Re:SBCL: The Ultimate Assembly Code Breadboard by anon_d on Sunday March 16, 2014 @02:34PM (#7410572)
I've settled into the following workflow:

    ghci Module.hs
    *mess around*
    :e *this opens Module.hs in vim, and reloads afterwords.*
    *mess around some more*
It's the best programming work-flow I've found in any language.
Re:SBCL: The Ultimate Assembly Code Breadboard by wging on Sunday March 16, 2014 @07:53PM (#7411997)
With emacs and haskell-mode, I just open a Haskell buffer, and C-c C-l (control-c control-l). This will reload that buffer into another buffer that runs GHCi, creating it if it doesn't exist and using the existing one if it does.
Re:SBCL: The Ultimate Assembly Code Breadboard by cscurmudgeon on Sunday March 16, 2014 @12:41PM (#7410059)
I have used the REPL in all those languages except for Erlang. Trust me. Nothing compares to Common Lisp's Slime. Not all REPLs are equal.
Re:SBCL: The Ultimate Assembly Code Breadboard by lambda on Sunday March 16, 2014 @12:48PM (#7410093)
Erlang has Distel, which is a pretty powerful SLIME like mode: https://github.com/massemanet/distel (and written by Luke Gorrie, the same guy who wrote SLIME).

I haven't used either Distel or SLIME extensively enough to say if it's comparable, but it looks fairly similar.

Re:SBCL: The Ultimate Assembly Code Breadboard by gsg on Monday March 17, 2014 @01:42AM (#7413325)
Sadly, true. I would cheerfully murder somebody for something as good as Slime for OCaml.
Re:SBCL: The Ultimate Assembly Code Breadboard by lispm on Sunday March 16, 2014 @02:51PM (#7410644)
The CLIs in these languages are mostly not widely used, provide only few features and are poorly integrated in the language.

Plus, most don't implement Lisp's READ EVAL PRINT LOOP, but a simpler command line interface.

Re:SBCL: The Ultimate Assembly Code Breadboard by anaphor on Sunday March 16, 2014 @03:04PM (#7410695)
Well none of these languages have anything like Lisp's `read`, but Haskell's interactive loop is fairly usable and extensible. You can add vi-like keybindings and interact with other programs like hoogle, which lets you look up things based on types.
Re:SBCL: The Ultimate Assembly Code Breadboard by lispm on Sunday March 16, 2014 @03:47PM (#7410908)
Does it provide integrated interactive error handling, break loops, debugging of compiled code, ...
Re:SBCL: The Ultimate Assembly Code Breadboard by anaphor on Sunday March 16, 2014 @04:26PM (#7411098)
It doesn't have a similar error handling system to lisp or scheme no, but it does have an interactive debugger, and the code does get compiled when you're in ghci (including whatever modules you have loaded).
Re:SBCL: The Ultimate Assembly Code Breadboard by pjmlp on Sunday March 16, 2014 @01:00PM (#7410164)
Yes, it is merely an implementation issue as I mentioned in another thread.

What I think still sets Lisp and Smalltalk apart, is their environments at Xerox PARC.

We are still far from having back this type of live editing experience in more mainstream languages.

Re:SBCL: The Ultimate Assembly Code Breadboard by mrottenkolber on Monday March 17, 2014 @07:25AM (#7414399)
Oh please. Besides the fact, that CL has a ton of other features which set it apart any of mentioned langs, none of their REPLs are comparable in power. We have interactive debuggers built in and a language designed for it.

Take this simple example:

  > (+ 1 "foo")
  
  The value "foo" is not of the expected type NUMBER.
     [Condition of type TYPE-ERROR]
  
  Restarts:
   0: [USE-VALUE] Use a new value of type NUMBER instead of "foo".
   ...

   > 0<RET>41<RET>

   => 42
  >
Re:SBCL: The Ultimate Assembly Code Breadboard by 616c on Sunday March 16, 2014 @12:18PM (#7409970)
What is this C++ REPL you speak of?
Re:SBCL: The Ultimate Assembly Code Breadboard by nimrody on Sunday March 16, 2014 @01:59PM (#7410427)
Try cling (http://root.cern.ch/drupal/content/cling) for just one example based on LLVM.
Re:SBCL: The Ultimate Assembly Code Breadboard by kijiki on Sunday March 16, 2014 @12:38PM (#7410050)
Re:SBCL: The Ultimate Assembly Code Breadboard by Create on Sunday March 16, 2014 @01:04PM (#7410179)
Re:SBCL: The Ultimate Assembly Code Breadboard by Turing_Machine on Sunday March 16, 2014 @01:29PM (#7410309)
Most implementations of Javascript give you a REPL (assuming that JIT counts) in the sense that there's no hard distinction between code loaded from a file and code typed at the console prompt.
Re:SBCL: The Ultimate Assembly Code Breadboard by agoetz on Sunday March 16, 2014 @11:39AM (#7409790)
FORTH comes to mind.
Re:SBCL: The Ultimate Assembly Code Breadboard by 616c on Sunday March 16, 2014 @11:42AM (#7409807)
Cool. No idea FORTH had a REPL. Do you use FORTH or have cool project examples?
Re:SBCL: The Ultimate Assembly Code Breadboard by pgeorgi on Sunday March 16, 2014 @12:51PM (#7410110)
OpenFirmware, such as the various implementations on http://www.openbios.org/ always comes with a Forth prompt.

I was part of the team that wrote the original Open Source implementation (under GPL terms) named OpenBIOS. The project now also hosts all kinds of other implementations that were later published under BSD terms by their owners (and had 10+ years of market experience under their belt at that time).

When FORTH started out, one of its differentiators was its live environment: you could test one step (part of an algorithm or similar) at the prompt, then define a "word" (= function) that implements it using the statements you tried, repeat until you finished your program using the words you defined earlier.

Re:SBCL: The Ultimate Assembly Code Breadboard by agumonkey on Monday March 17, 2014 @05:18PM (#7418164)
The only time you're happy to reboot a machine is when it has OpenFirmware Forth so you can play a bit with it.
Re:SBCL: The Ultimate Assembly Code Breadboard by lbruder on Sunday March 16, 2014 @01:07PM (#7410199)
Forth not only has a REPL, but an incremental compiler, too. Have a look at http://www.forth.com/starting-forth/index.html, you'll be amazed what Forth has to offer! Interactive microcontroller debugging is every bit as fun as it sounds :)
Re:SBCL: The Ultimate Assembly Code Breadboard by wiml on Sunday March 16, 2014 @04:55PM (#7411234)
Do you have any favorite compact Forth implementations for AVRs? Each time I find myself writing a configuration-and-introspection parser for a microcontroller project I think to myself, "I should just expose a REPL here", and FORTH is the obvious choice, but I've never had the time to dig through the many AVR FORTH implementations out there for the right one.
Re:SBCL: The Ultimate Assembly Code Breadboard by lbruder on Monday March 17, 2014 @12:48AM (#7413132)
AmForth (http://amforth.sourceforge.net/) is my current favorite, but like with Linux distros, my tastes are somewhat floating. So I'm writing my own little weekend Forth just for playing around ;)
Re:SBCL: The Ultimate Assembly Code Breadboard by wolfgke on Sunday March 16, 2014 @11:45AM (#7409820)
FORTH had (and has) a REPL.
Re:SBCL: The Ultimate Assembly Code Breadboard by RBerenguel on Sunday March 16, 2014 @01:09PM (#7410209)
Well, I wouldn't say Forth is specially "usable," (I'm far from an expert, so this may be it) but it applies: compiled with a REPL.
Re:SBCL: The Ultimate Assembly Code Breadboard by 616c on Sunday March 16, 2014 @11:41AM (#7409802)
Does it matter if it is a bare-bone systems language with no GC or automated memory management?

Erlang and Elixir, a new language for the Erlang VM with a different syntax, are compiled languages with REPLs. I also think about Scala and others for the JVM, but I have a feeling you do not think of those as examples because of the VM or the lack of native code compilation. I could be wrong.

Re:SBCL: The Ultimate Assembly Code Breadboard by pjmlp on Sunday March 16, 2014 @12:55PM (#7410136)
Any language can have a REPL, it is a plain implementation issue.
Re:SBCL: The Ultimate Assembly Code Breadboard by lispm on Sunday March 16, 2014 @06:21PM (#7411666)
It's not. You will detect that in many cases it is a language issue, too. If you look at Lisp, you can see that the language definitions are optimized for interactive use and have a lot of facilities defined at the language level: incremental definitions, evaluation, effects of loading code, a robust interactive error system, ...
Re:SBCL: The Ultimate Assembly Code Breadboard by pjmlp on Monday March 17, 2014 @03:26AM (#7413630)
How come it is not?

- Create an interpreter library for language X

- Offer a GUI/CLI application using the said library

Not all repls need to work at function level like LISP does.

Re:SBCL: The Ultimate Assembly Code Breadboard by lispm on Monday March 17, 2014 @09:11AM (#7414792)
Re:SBCL: The Ultimate Assembly Code Breadboard by pjmlp on Monday March 17, 2014 @11:28AM (#7415598)
So you use existing bugs in one given implementation to defend your point of view?
Re:SBCL: The Ultimate Assembly Code Breadboard by lispm on Thursday March 20, 2014 @04:15AM (#7434391)
So you redefine missing features due to language problems as 'bug' to defend your point of view?
Re:SBCL: The Ultimate Assembly Code Breadboard by camperman on Sunday March 16, 2014 @12:36PM (#7410039)
LuaJIT.
Re:SBCL: The Ultimate Assembly Code Breadboard by bsilvereagle on Sunday March 16, 2014 @09:45PM (#7412398)
Julia