March 14, 2015
On 3/13/15 6:32 PM, H. S. Teoh via Digitalmars-d wrote:
> On Fri, Mar 13, 2015 at 04:14:30PM -0700, Andrei Alexandrescu via Digitalmars-d wrote:
>> On 3/13/15 3:14 PM, Walter Bright wrote:
>>> On 3/13/2015 12:01 PM, weaselcat wrote:
>>>> On Friday, 13 March 2015 at 18:55:18 UTC, Walter Bright wrote:
>>>>> On 3/13/2015 3:34 AM, bearophile wrote:
>>>>>> "Strict mode" is a D2 with immutable+@safe+pure by default,
>>>>>
>>>>> Note that you can get this largely by starting a module with the
>>>>> following:
>>>>>
>>>>>    immutable @safe pure:
>>>>>
>>>>
>>>> As far as I'm aware, there's no way to mark functions impure this
>>>> way other than lexical location. Am I incorrect?
>>>
>>> You are correct, which is why D also supports:
>>>
>>>     immutable @safe pure {
>>>        ... nice declarations ...
>>>     }
>>>
>>>     ... naughty declarations ...
>>
>> The bottom line is we need a way to undo attributes. -- Andrei
>
> Which people have been clamoring for, for a long time now.

That's why we need it! :o) -- Andrei

March 14, 2015
On 3/13/15 5:54 PM, deadalnix wrote:
> On Saturday, 14 March 2015 at 00:34:35 UTC, Ziad Hatahet wrote:
>> On Fri, Mar 13, 2015 at 6:45 AM, Russel Winder via Digitalmars-d <
>> digitalmars-d@puremagic.com> wrote:
>>
>>> The removal of shared memory multi-threading in favour of using
>>> processes and channels should never be underestimated as a Really Good
>>> Thing™ that other native code languages (*) have failed to do anything
>>> about. Thus Go wins, others lose.
>>>
>>
>> Except that Go does not really remove shared memory multithreading; it is
>> still possible to get data races (which is why they have a race
>> detector).
>> They provide channels, but nothing is preventing races other than
>> convention. On the other hand, Rust (a native code language) offers a
>> much
>> superior solution, with compile-time enforcement of data sharing.
>>
>> --
>> Ziad
>
> How very true, but, by the time you run into data races, you are pretty
> much commited to go.
>
> Sad.

I'm surprised Russel fell for it. -- Andrei

March 14, 2015
On Saturday, 14 March 2015 at 03:12:39 UTC, Andrei Alexandrescu wrote:
> On 3/13/15 5:54 PM, deadalnix wrote:
>> On Saturday, 14 March 2015 at 00:34:35 UTC, Ziad Hatahet wrote:
>>> On Fri, Mar 13, 2015 at 6:45 AM, Russel Winder via Digitalmars-d <
>>> digitalmars-d@puremagic.com> wrote:
>>>
>>>> The removal of shared memory multi-threading in favour of using
>>>> processes and channels should never be underestimated as a Really Good
>>>> Thing™ that other native code languages (*) have failed to do anything
>>>> about. Thus Go wins, others lose.
>>>>
>>>
>>> Except that Go does not really remove shared memory multithreading; it is
>>> still possible to get data races (which is why they have a race
>>> detector).
>>> They provide channels, but nothing is preventing races other than
>>> convention. On the other hand, Rust (a native code language) offers a
>>> much
>>> superior solution, with compile-time enforcement of data sharing.
>>>
>>> --
>>> Ziad
>>
>> How very true, but, by the time you run into data races, you are pretty
>> much commited to go.
>>
>> Sad.
>
> I'm surprised Russel fell for it. -- Andrei

Don't be surprised, because, by the time you run into data races, you are pretty much committed to go.
March 14, 2015
On Fri, Mar 13, 2015 at 08:12:15PM -0700, Andrei Alexandrescu via Digitalmars-d wrote:
> On 3/13/15 6:32 PM, H. S. Teoh via Digitalmars-d wrote:
> >On Fri, Mar 13, 2015 at 04:14:30PM -0700, Andrei Alexandrescu via Digitalmars-d wrote:
> >>On 3/13/15 3:14 PM, Walter Bright wrote:
> >>>On 3/13/2015 12:01 PM, weaselcat wrote:
> >>>>On Friday, 13 March 2015 at 18:55:18 UTC, Walter Bright wrote:
> >>>>>On 3/13/2015 3:34 AM, bearophile wrote:
> >>>>>>"Strict mode" is a D2 with immutable+@safe+pure by default,
> >>>>>
> >>>>>Note that you can get this largely by starting a module with the following:
> >>>>>
> >>>>>   immutable @safe pure:
> >>>>>
> >>>>
> >>>>As far as I'm aware, there's no way to mark functions impure this way other than lexical location. Am I incorrect?
> >>>
> >>>You are correct, which is why D also supports:
> >>>
> >>>    immutable @safe pure {
> >>>       ... nice declarations ...
> >>>    }
> >>>
> >>>    ... naughty declarations ...
> >>
> >>The bottom line is we need a way to undo attributes. -- Andrei
> >
> >Which people have been clamoring for, for a long time now.
> 
> That's why we need it! :o) -- Andrei

Yes, and it's about time it finally got acknowledged! :-P


T

-- 
Notwithstanding the eloquent discontent that you have just respectfully expressed at length against my verbal capabilities, I am afraid that I must unfortunately bring it to your attention that I am, in fact, NOT verbose.
March 14, 2015
On Fri, 2015-03-13 at 16:13 -0700, Andrei Alexandrescu via Digitalmars-d wrote:
> On 3/13/15 2:22 PM, Russel Winder via Digitalmars-d wrote:
> > On Fri, 2015-03-13 at 10:31 -0700, Andrei Alexandrescu via Digitalmars-d
> > wrote:
> > […]
> >
> >>
> >>     File("/tmp/a").byChunk(4096).joiner.startsWith(s)
[…]
> 
> How do you mean "conversely"? Maybe you meant "incidentally"? -- Andrei

In functional languages, each stage in the pipeline returns Option to avoid error handling. Go does not give you this facility as it refuses to allow activity without proper error checking.

So if byChunk returns a failed read, functional language just carry on, Go would force the error check, D does…

-- 
Russel. ============================================================================= Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder@ekiga.net 41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel@winder.org.uk London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder


March 14, 2015
On Friday, 13 March 2015 at 23:10:21 UTC, Andrei Alexandrescu wrote:
> On 3/13/15 2:02 PM, Almighty Bob wrote:
>> The language reference is pretty abysmal too. EG...
...
>> The page on templates starts with scope and instantiation details. The
>> examples at the start have alias parameters which aren't explained until
>> half way down the page.
>
> The language reference is fine if arid. One shouldn't learn the language from its reference. It should be, however, complemented by tutorials. -- Andrei


On the language reference:

The D documentation as an introduction is readable, though large. Relative to that, the DLib documentation hurts.
http://dlang.org/arrays.html
http://dlang.org/phobos/std_array.html

When I was new to PHP, I can tell you that the php.net/<funcname> method of learning was a big help. It redirected me to the appropriate manual page and manual pages had code snippets, often provided in the comments section.


As an example, I want to do something random, and the PHP docs are much easier to understand.
http://php.net/rand
http://dlang.org/phobos/std_random.html


-Charles
March 14, 2015
On Fri, 2015-03-13 at 14:51 +0000, Chris via Digitalmars-d wrote: […]
> 
> [1] The problem is that all these nice Python and R implementations are practically useless for real world applications. Too slow, too cumbersome, too many dependencies. It has to be rewritten anyway. (I'd be happy, if they used at least C.)

I am not sure which "real world" you are living in, but I have Python code that executes computationally intensive codes at least as fast as C, C++, and Fortran. R is slow in comparison. Python code is generally easier to read and write than C, C++ and Fortran, so not cumbersome. Dependencies depends on what you want to use in any programming languages so all fail on that metric. No-one in 2015 should be writing any application in C; it is too low-level a language for the current state of programming.

In the real world as I know it people use Python for masses of stuff and it does the job well. Statisticians use R.
-- 
Russel. ============================================================================= Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder@ekiga.net 41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel@winder.org.uk London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder


March 14, 2015
On Fri, 2015-03-13 at 07:59 -0700, Andrei Alexandrescu via Digitalmars-d wrote:
> On 3/13/15 7:34 AM, Russel Winder via Digitalmars-d wrote:
[…]
> >
> > It is not Python or R or Julia the language that people choose, it is the superstructure built on top. So for Python, it is Pandas, Matplotlib, SciPy, NumPy. And the ability to use ready made C, C++ and Fortran libraries.
> 
> That's right. Offer solid value, and make learning the language just aftermath. Again, that's why I'm pushing for vibe. -- Andrei

That's OK for its domain of event-driven systems, but there is much, much more.

If D is to compete in the financial computing arena where Python and R currently rule, there needs to be all the libraries for doing time series analysis, and rendering them graphically. There also needs to be a workflow that fits the users of the domain. The market leader is currently Jupyter (*) in the finance places I have connection with.

The point here is that these folk (and all the bioinformatics, and others using computers for modelling systems) need a highly interactive, stitched together code fragment, based system. 1960s edit-compile-run workflows do not work for these people. REPLs sort of work, but not well. Jupyter really gets these people moving. They are writing HTML/PDF documents with embedded, executable code. It is the 2015s version of literate programming. Except that they are writing about their domain, not about the code.

What D should do is ensure that it can be a language usable from Jupyter?


(*) IPython grew out of Python and become the de facto system, but was a mess structurally. IPython is splitting into IPython the original thing and Jupyter all the UI related stuff that grew on IPython but made it messy. The new structuring makes things better and allows Jupyter to be clearly not just a Python thing. So you can run R, Julia,… as well as Python as the code fragments.

-- 
Russel. ============================================================================= Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder@ekiga.net 41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel@winder.org.uk London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder


March 14, 2015
On Fri, 2015-03-13 at 07:55 -0700, Andrei Alexandrescu via Digitalmars-d wrote:
> On 3/13/15 6:45 AM, Russel Winder via Digitalmars-d wrote:
> > The removal of shared memory multi-threading in favour of using processes and channels should never be underestimated as a Really Good Thing™ that other native code languages (*) have failed to do anything about. Thus Go wins, others lose.
> 
> That's a marketing success as well. Go didn't "remove" shared memory multi-threading, it just unrecommends it. That's quite unremarkable from a programming language design standpoint, but as discussed that's not always crucial for success. -- Andrei

I think you need to show a bit of Go code that uses threads to be able to back up that claim.

-- 
Russel. ============================================================================= Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder@ekiga.net 41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel@winder.org.uk London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder


March 14, 2015
On Saturday, 14 March 2015 at 08:40:53 UTC, Russel Winder wrote:
> On Fri, 2015-03-13 at 16:13 -0700, Andrei Alexandrescu via Digitalmars-d
> wrote:
>> On 3/13/15 2:22 PM, Russel Winder via Digitalmars-d wrote:
>> > On Fri, 2015-03-13 at 10:31 -0700, Andrei Alexandrescu via Digitalmars-d
>> > wrote:
>> > […]
>> >
>> >>
>> >>     File("/tmp/a").byChunk(4096).joiner.startsWith(s)
> […]
>> 
>> How do you mean "conversely"? Maybe you meant "incidentally"? -- Andrei
>
> In functional languages, each stage in the pipeline returns Option to
> avoid error handling. Go does not give you this facility as it refuses
> to allow activity without proper error checking.
>
> So if byChunk returns a failed read, functional language just carry on,
> Go would force the error check,
>D does…
D throws an exception that you would catch with a try block(or scope(failure) )?
I've never seen Go praised for its error handling, it is always the opposite.

Go error handling is verbose and ugly. http://blog.golang.org/error-handling-and-go