On Thu, May 30, 2013 at 9:18 AM, Diggory
<diggsey@googlemail.com> wrote:
On Thursday, 30 May 2013 at 15:05:40 UTC, monarch_dodra wrote:
On Thursday, 30 May 2013 at 14:55:38 UTC, someone wrote:
Please think about the huge math and science community. Most of them I came across like D for its speed and efficiency. But D can never replace Matlab/Octave/Ipython/Scipy because ....
.. of the messy syntax compared to almost math like syntax above languages offer.
For example, if I want to quickly want to plot something, in Octave I would do:
x = linspace(0, 2*pi, 1000);
y = sin(x);
plot(x, y)
I could be mistaken, but those languages don't have the notion of declaration, do they? (honest question)
Last time I tried a similar language, basically, any variable name that is not yet used is resolved to null. Which is why the syntax work.
D on the other hand has a strong notion of declaration, and construction.
I'm not sure it's just a matter of "messy syntax", and more of different paradigms. In D, it is more important to make the distinction of construction/assignment. The syntax is messy, but the new syntax blurs that line.
There's another alternative that fits more with D style which is also very mathsy.
It would be possible to make storage classes work with the colon syntax, ie:
auto:
x = 1;
y = 2;
f = a => a+1
writeln(f(x) + y);
Also:
immutable:
x = 3;
y = 4;
Kind of like option explicit: off in VB