www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - A Mathematician looks at D

reply "Joshua Niehus" <jm.niehus gmail.com> writes:
http://www.reddit.com/r/programming/comments/18r7zk/a_mathematician_looks_at_d/

No "REPL", I guess we are rubbish?
Feb 18 2013
next sibling parent reply "Joshua Niehus" <jm.niehus gmail.com> writes:
Personally I find REPLs super annoying, especially when you need 
to "import" or "require" something or like to use multiple lines. 
  Serious how hard is it to just do:

### Ruby
#!/usr/bin/ruby
require "pp"

puts "do stuff"

// D
#!/usr/bin/rdmd
import std.stdio;

void main() {
     writeln("do stuff");
}

then press "Command+b" (Sublime text) and watch it work/fail?
Feb 18 2013
parent Jacob Carlborg <doob me.com> writes:
On 2013-02-18 23:13, Joshua Niehus wrote:
 Personally I find REPLs super annoying, especially when you need to
 "import" or "require" something or like to use multiple lines.  Serious
 how hard is it to just do:

 ### Ruby
 #!/usr/bin/ruby
 require "pp"

 puts "do stuff"

 // D
 #!/usr/bin/rdmd
 import std.stdio;

 void main() {
      writeln("do stuff");
 }

 then press "Command+b" (Sublime text) and watch it work/fail?
In general I agree with you. But since I've found the Pry REPL for Ruby I'm pretty sold on it: http://pryrepl.org/ Scroll down to the features list below the screencast. -- /Jacob Carlborg
Feb 18 2013
prev sibling next sibling parent reply "bearophile" <bearophileHUGS lycos.com> writes:
Joshua Niehus:

 Serious how hard is it to just do:
 then press "Command+b" (Sublime text) and watch it work/fail?
With a REPL you don't need to repeat the precedent computations every time you add something. You keep building on what you have already done. This saves you time (beside saving you the time of hundreds of compilations). A REPL is handy when you don't know the correct usage of something: you try something, read the error it gives you, ask for some help to the system, and try again, etc. A REPL is very handy when you are doing http://en.wikipedia.org/wiki/Exploratory_programming If your interactive system also has some cumulative graphics output this is very handy, you can rotate and change plot parameters interactively until you find some good ones (this is possible in Mathematica). Bye, bearophile
Feb 18 2013
parent reply Nick Sabalausky <SeeWebsiteToContactMe semitwist.com> writes:
On Mon, 18 Feb 2013 23:37:00 +0100
"bearophile" <bearophileHUGS lycos.com> wrote:
 
 A REPL is handy when you don't know the correct usage of 
 something: you try something, read the error it gives you, ask 
 for some help to the system, and try again, etc.
I can do that just as easily without a REPL.
 
 If your interactive system also has some cumulative graphics 
 output this is very handy, you can rotate and change plot 
 parameters interactively until you find some good ones (this is 
 possible in Mathematica).
 
This, however, is certainly not a bad benefit of REPL.
Feb 18 2013
parent reply "bearophile" <bearophileHUGS lycos.com> writes:
Nick Sabalausky:

 I can do that just as easily without a REPL.
With a much reduced interactivity and more slowly. In Python you have full run-time introspection available from the REPL. You have commands like dir() and help(). Plus the error messages. If you are using iPython or a graphical shell things gets even better. Combined with the time you save not compiling & running your whole proggy again, it allows you a different flow of work. And when you do exploratory programming such saved time is important, because it helps you to not lose your current train of thoughts. Most exploratory mathematics systems have a REPL, because for some people and for some kinds of problems, it's much better to have it. It's not for everyone nor for every kind problem. Bye, bearophile
Feb 18 2013
next sibling parent reply Nick Sabalausky <SeeWebsiteToContactMe semitwist.com> writes:
On Tue, 19 Feb 2013 00:55:44 +0100
"bearophile" <bearophileHUGS lycos.com> wrote:

 Nick Sabalausky:
 
 I can do that just as easily without a REPL.
With a much reduced interactivity and more slowly.
Slightly so. I wouldn't say "much". But of course, I'm not saying that a REPL wouldn't be nice to have. Just saying that "edit, re-compile/run" really isn't all *that* bad.
Feb 18 2013
parent FG <home fgda.pl> writes:
On 2013-02-19 01:28, Nick Sabalausky wrote:
 I can do that just as easily without a REPL.
With a much reduced interactivity and more slowly.
Slightly so. I wouldn't say "much". But of course, I'm not saying that a REPL wouldn't be nice to have. Just saying that "edit, re-compile/run" really isn't all *that* bad.
If you're processing a significant data set in an exploratory way, with many intermediate calculations, then Python with gluplot or whatever beats the productivity of edit-compile-run. As another example of interactive vs. recompiled approach, I'm fine with using TeX for writing - it is quite comfortable even without seeing final formatting when writing (or thanks to that) - but making graphics in it using PGF/TikZ instead of an interactive illustration program becomes rather painful and is the example of much reduced interactivity and speed. Edit-compile-run way would be quite good (assuming a very fast compiler) if processing blocks could be added incrementally and state from the previous runs could be _easily_ restored in the next one. Then the difference between a scripting language and a compiled one would be blurred. Coming back to the TeX example. It's a fast typesetting system - can compile some books in under a second (up to a few seconds if using XeLaTeX and TTF fonts). Yet it's way to slow for testing many small changes or generating documents like invoices en masse. It would make a great invoicing system if it was possible to save the state of it using an empty document and all necessary packages loaded and then only restore that and add the body on each run.
Feb 19 2013
prev sibling parent reply "Joshua Niehus" <jm.niehus gmail.com> writes:
On Monday, 18 February 2013 at 23:55:46 UTC, bearophile wrote:
 Most exploratory mathematics systems have a REPL, because for 
 some people and for some kinds of problems, it's much better to 
 have it. It's not for everyone nor for every kind problem.
I'll take your word for it, in my narrow experience, I've found REPLs slow me down. And as for graphing math problems, I found MatLab, Mathematica or even OSX's "Grapher" to be sufficient for my usages (when I was a student). In any event, I wouldn't consider a language "rubbish" because it doesn't have a REPL.
Feb 18 2013
next sibling parent reply "bearophile" <bearophileHUGS lycos.com> writes:
Joshua Niehus:

 I'll take your word for it, in my narrow experience, I've found 
 REPLs slow me down.
Thankfully in most cases you are not forced to use it. I have met several persons that don't like to use a REPL, for unknown reasons. Different persons have a brain shaped in different ways. And for some kind of problems it's not so good. So it's not for everyone everytime. But from the presence of a REPL in many languages (Python, Ruby, C, Haskell, Scala, Lisp-like languages, and so on) and in most mathematics systems, clearly it's appreciated by some others. Bye, bearophile
Feb 18 2013
parent "Paulo Pinto" <pjmlp progtools.org> writes:
On Tuesday, 19 February 2013 at 01:36:31 UTC, bearophile wrote:
 Joshua Niehus:

 I'll take your word for it, in my narrow experience, I've 
 found REPLs slow me down.
Thankfully in most cases you are not forced to use it. I have met several persons that don't like to use a REPL, for unknown reasons. Different persons have a brain shaped in different ways. And for some kind of problems it's not so good. So it's not for everyone everytime. But from the presence of a REPL in many languages (Python, Ruby, C, Haskell, Scala, Lisp-like languages, and so on) and in most mathematics systems, clearly it's appreciated by some others. Bye, bearophile
Smalltalk way of working is also quite nice. It only got spoiled by the image concept. If the compiler is made available as a library, it is quite easy to have a REPL in any language and it is quite handy for prototyping. -- Paulo
Feb 19 2013
prev sibling parent "so" <so so.so> writes:
On Tuesday, 19 February 2013 at 00:57:31 UTC, Joshua Niehus wrote:
 On Monday, 18 February 2013 at 23:55:46 UTC, bearophile wrote:
 Most exploratory mathematics systems have a REPL, because for 
 some people and for some kinds of problems, it's much better 
 to have it. It's not for everyone nor for every kind problem.
I'll take your word for it, in my narrow experience, I've found REPLs slow me down. And as for graphing math problems, I found MatLab, Mathematica or even OSX's "Grapher" to be sufficient for my usages (when I was a student). In any event, I wouldn't consider a language "rubbish" because it doesn't have a REPL.
Assuming we are talking about same thing (as all language trying to replicate the lisp based REPL, and failing, it is possible you haven't seen the real thing), it can't possibly slow you down, quite quite (could add more) the opposite. It is not forced, it is a gift. You hit the same compile key but you don't have to compile everything, you can compile a single function or a file and you don't have to restart anything, you can do all this in a running application and work as you see the changes take effect.
Feb 20 2013
prev sibling next sibling parent =?UTF-8?B?U8O2bmtlIEx1ZHdpZw==?= <sludwig outerproduct.org> writes:
Am 18.02.2013 23:06, schrieb Joshua Niehus:
 http://www.reddit.com/r/programming/comments/18r7zk/a_mathematician_looks_at_d/
 
 
 No "REPL", I guess we are rubbish?
There once was this approach: http://forum.dlang.org/thread/fpmpa6$2muq$1 digitalmars.com Not full D, but the concept should be extensible.
Feb 19 2013
prev sibling parent reply "so" <so so.so> writes:
On Monday, 18 February 2013 at 22:07:00 UTC, Joshua Niehus wrote:
 http://www.reddit.com/r/programming/comments/18r7zk/a_mathematician_looks_at_d/

 No "REPL", I guess we are rubbish?
http://en.wikipedia.org/wiki/Read–eval–print_loop says almost ALL languages one way or another have it, mentions c/c++... a sick joke to someone who has C++ background and learning CL. Language wars are over and substance is not the victor, it doesn't mean anything anymore, everything has FP, OOP, GUI, REPL, LC, RP, OSD... and what have you. It is like all computer industry is swarmed by marketing and no actual programmer/scientist left. REPL in CL is "live coding", not a language feature from future, something already there for many decades. You have an application *running* you change something, you hit a button and *instantly* you have the result right there in front of you. If you don't have a REPL (and many other features probably only available to lisp), yes you are rubbish if you are a dynamic language. D's strength is templates, static typing and needs focus on that.
Feb 20 2013
parent reply "Paulo Pinto" <pjmlp progtools.org> writes:
On Wednesday, 20 February 2013 at 09:11:15 UTC, so wrote:
 On Monday, 18 February 2013 at 22:07:00 UTC, Joshua Niehus 
 wrote:
 http://www.reddit.com/r/programming/comments/18r7zk/a_mathematician_looks_at_d/

 No "REPL", I guess we are rubbish?
http://en.wikipedia.org/wiki/Read–eval–print_loop says almost ALL languages one way or another have it, mentions c/c++... a sick joke to someone who has C++ background and learning CL.
Well you always have CINT. http://root.cern.ch/drupal/content/cint
 It is like all computer industry is swarmed by marketing and no 
 actual programmer/scientist left. REPL in CL is "live coding", 
 not a language feature from future, something already there for 
 many decades. You have an application *running* you change 
 something, you hit a button and *instantly* you have the result 
 right there in front of you.
Quite true. Smalltalk and Lisp were already doing in the late 70's, funny how we ended up exchanging such development environments for primitive languages like C in name of performance, only to try to duplicate them almost 50 years later. Every time I see a live coding demo I can only laugh and remember I was doing that back in 1995 in Smalltalk VisualWorks.
Feb 20 2013
parent reply "so" <so so.so> writes:
On Wednesday, 20 February 2013 at 12:27:46 UTC, Paulo Pinto wrote:

 Smalltalk and Lisp were already doing in the late 70's, funny 
 how we ended up exchanging such development environments for 
 primitive languages like C in name of performance, only to try 
 to duplicate them almost 50 years later.

 Every time I see a live coding demo I can only laugh and 
 remember I was doing that back in 1995 in Smalltalk VisualWorks.
I was ignorant of all of this and took me more than six years to learn such development environments existed and that is by luck (more like hunch). This is still somehow healthy process as i am going forward. What is your excuse? How do you put up with this? You are so much better than me, because i know i couldn't.
Feb 20 2013
parent reply "Paulo Pinto" <pjmlp progtools.org> writes:
On Wednesday, 20 February 2013 at 14:13:17 UTC, so wrote:
 On Wednesday, 20 February 2013 at 12:27:46 UTC, Paulo Pinto 
 wrote:

 Smalltalk and Lisp were already doing in the late 70's, funny 
 how we ended up exchanging such development environments for 
 primitive languages like C in name of performance, only to try 
 to duplicate them almost 50 years later.

 Every time I see a live coding demo I can only laugh and 
 remember I was doing that back in 1995 in Smalltalk 
 VisualWorks.
I was ignorant of all of this and took me more than six years to learn such development environments existed and that is by luck (more like hunch). This is still somehow healthy process as i am going forward. What is your excuse? How do you put up with this? You are so much better than me, because i know i couldn't.
I was lucky that my university (FCT/UNL in Lisbon) had a strong focus in compiler design, which made me experiment a lot of languages. That Smaltalk environment was used for creation of a reversi clone. :) It is a matter of what you get to pay to do. For example I would also rather do desktop applications than web ones, but here in Germany almost everyone is paying for WebUIs, so I need to put up with it. Similar with programming languages. Have you ever seen this video of how Lisp machines used to be? http://www.loper-os.org/?p=932 The later model Ivory was even better. All of this in the 80s.
Feb 20 2013
parent "so" <so so.so> writes:
On Wednesday, 20 February 2013 at 14:29:19 UTC, Paulo Pinto wrote:

 Have you ever seen this video of how Lisp machines used to be?

 http://www.loper-os.org/?p=932

 The later model Ivory was even better. All of this in the 80s.
I have seen that but too much hardware talk which i have not much interest, i'll try again.
Feb 20 2013