News for hackers. Stuff that matters.
Re:Two years of Rust by derefr on Monday May 15, 2017 @07:03PM (#14345971)
> What's your experience level with other languages?

~15 years experience across C, ARM assembler, Javascript, Lua, Ruby, Python, Erlang, Go, and Rust. Mostly doing Elixir these days.

Admittedly, I've never used an IDE; I write all my C in vim.

> ...you write compiled unit tests and/or test programs to poke around at the API.

That assumes you can get your tests to compile; or that the compilation errors are at-all helpful when they don't. If you've got a library that

1. ships as a binary blob + header files, and

2. most of its functions take handles to structs that are declared opaquely in the SDK headers; and yet

3. nothing you do with the badly-documented "create handle" parts of the API is giving you a struct that the "consume handle" parts of API will do anything with but crash...

...then you'll really wish that you had a REPL; or rather, a language runtime that enforced some level of introspect-ability on everything, so that a REPL could show you what's in the struct and whether your calls so far have failed to touch some obviously-necessary-to-fill-in part of it.

Without such support, you will have to rely on reading the decompilation results of both ends of the API to figure out what's really going on.

Re:Two years of Rust by zzalpha on Monday May 15, 2017 @09:38PM (#14346762)
or rather, a language runtime that enforced some level of introspect-ability on everything

And now we get to the real meat of it.

It's not a REPL you want.

It's reflection.

It just so happens that the latter is frequently paired with the former.

And I agree, that feature, which separates C#, Java, Ruby, Perl, Python, etc, from legacy languages like C make them significantly easier to use as a developer as the compiler, debugger, and IDE can do a much better job.

But as a feature it's orthogonal to a REPL.

Re:Two years of Rust by derefr on Monday May 15, 2017 @10:09PM (#14346869)
Reflection isn't orthogonal to a REPL; it's synergistic with a REPL. When you have a static language, yes, REPLs don't add much; reflection by itself is all you need and an IDE will suit you fine.

But when you are working in a language with runtime code generation—one where objects can build themselves new runtime-native function handles in response to messages—then a REPL will be able to do things for you that an IDE cannot†.

A REPL in a dynamic language (that takes advantage of its dynamicity) can be used to "explore" down CORBA/DBUS object trees; or fluently walk REST or SOAP endpoints without needing pre-baked WSDL descriptors to guide you to them. Heck, an Erlang REPL can hot-upgrade remote nodes. :)

† Or, at least, not a traditional IDE. You would need an IDE connected to a "live session" of your project—essentially a hybrid IDE-REPL. (Examples: Light Table; Emacs' CIDER extension for Clojure.)

Re:Two years of Rust by pjmlp on Tuesday May 16, 2017 @08:02AM (#14348884)
Lisp, Smalltalk and Mesa XDE at Xerox PARC are the genesis of what an IDE is supposed to be.

Two dynamic and one static languages.

Re:Two years of Rust by photojosh on Monday May 15, 2017 @08:15PM (#14346368)
> then you'll really wish that you had a REPL

Yes. I write roughly equal amounts of C (microcontroller firmware) and Python (overall system control, running on embedded Linux).

I absolutely wish I had a REPL for C. When implementing with a new library in Python, I'll usually use iPython to explore it, and if I need to run a decent amount of data through, I'll use a Jupyter notebook. I'd put the difficulty of grokking a C library somewhere between 10x and 100x harder.

Re:Two years of Rust by yorwba on Monday May 15, 2017 @11:33PM (#14347180)
I use gdb as a C REPL. You attach it to a binary that has the functions you need, then you can use them with the `p` (or `print`) command. Loops and new function definitions are not possible, but sometimes it's still good enough.
Re:Two years of Rust by RhysU on Tuesday May 16, 2017 @07:54AM (#14348858)
Gdb as REPL is a nice trick. Beaker Notebook might give the notebook parent wants for C work.
Re:Two years of Rust by photojosh on Wednesday May 17, 2017 @09:09PM (#14364155)
Thanks. It won't since all my C work is embedded and mainly systems programming rather than algorithms. But I'll keep it in mind for the next time I have to translate my Python explorations over to C for production.
Re:Two years of Rust by photojosh on Wednesday May 17, 2017 @09:04PM (#14364131)
Good point. I've only been working with AVRs for a few years since I've been at this job, but looks like it might be doable. Thanks for the tip.
Re:Two years of Rust by pjmlp on Tuesday May 16, 2017 @02:49AM (#14347829)
That is how I once developed a B+ Tree library for low level disk blocks back in 1996, it was quite helpful tracking down how the nodes were being used.
Re:Two years of Rust by pjmlp on Tuesday May 16, 2017 @02:47AM (#14347821)
C has had REPLs since the 90's, one just needs to search for them, and eventually buy them.

They were quite common advertising in The C User's Journal and Dr. Dobbs.