March 13, 2015
On Friday, 13 March 2015 at 15:17:06 UTC, Andrei Alexandrescu wrote:
> This in big bold font, too. The HTML way of saying, "you wanted startsWith? I'll give you more startsWith than you can carry." Picture the effect this has on someone who just wanted to see if a string starts with another.
>
> We need to make the template constraints distinct for formatting in ddoc.
>
> Sadly http://dlang.org/library/std/algorithm/starts_with.html is bad in other ways. It doesn't have any examples! In contrast, the unified page does have some decent examples.
>
> This all is under the "curb appeal" category.

The language reference is pretty abysmal too. EG...

The language "Introduction" spends all it's time talking about phases of compilation. That's like introducing someone to driving by explaining how the internal combustion engine works.

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.

I mean why no start the template page with something that people will find familiar and then build on that?

It has that feel all the way through. You go looking for things and they never seem to be where you expect, or they are so tersely explained, it feels like it's a reference for people already experts in D. Which is fine if that's what it's meant to be ... but if you want to attract new people you need a "guided tour" rather than a "technical spec".

March 13, 2015
On Friday, 13 March 2015 at 21:02:39 UTC, Almighty Bob wrote:
> The language reference is pretty abysmal too. EG...
>
> The language "Introduction" spends all it's time talking about phases of compilation. That's like introducing someone to driving by explaining how the internal combustion engine works.
>
> 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.
>
> I mean why no start the template page with something that people will find familiar and then build on that?
>
> It has that feel all the way through. You go looking for things and they never seem to be where you expect, or they are so tersely explained, it feels like it's a reference for people already experts in D. Which is fine if that's what it's meant to be ... but if you want to attract new people you need a "guided tour" rather than a "technical spec".

The language reference is a reference; it's supposed to be a
technical spec, not a starting point. That said, the only links to starting points are the book (which isn't free) and the "Programming in D" pages at
http://ddili.org/ders/d.en/index.html (which are now buried in the Articles tab)
March 13, 2015
> Yah, we sorely need a way to undo an attribute. BTW "@undo" is short and sweet. -- Andrei

I thought reusing keywords is what you like:

Example #1:
----
pure:
nothrow:

// ... some stuff

default: // not pure/nothrow
----

Example #2:
----
class Foo {
final:
    // ...
default: // virtual
    // ...
}
----
March 13, 2015
Walter Bright:

> On 3/13/2015 3:34 AM, bearophile wrote:
>> "Strict mode" is a D2 with immutable+@safe+pure by default,

Thank you Walter for giving me an actual answer :-)


> Note that you can get this largely by starting a module with the following:
>
>    immutable @safe pure:

"immutable" in my post was mostly referring to local variables, foreach variables and so on.


>> something like a "var" keyword to denote mutable values,
>
> Transitive const may make this problematic.

I don't understand, but perhaps you misunderstood me. I am talking about variables. In strict mode they are constant by default. This means in this code both x and y are immutable:

auto x = 10;
foreach (y; 0 .. 10) {}

So in strict mode if you want them mutable you need a new keyword like "var":

var x = 10;
foreach (var y; 0 .. 10) {}



>> static full tracking of memory ownership,
>
> Makes the language significantly more complex.

You are probably right. But it also gives good things back to a system language.
In the last years I've seen that taking twice the time to write my code is a good deal if later I can avoid wasting stressful hours searching and fixing bugs. So now I am willing to pay a high price up front when I code to avoid some bugs later. I have friends that have taken a look at Rust and have dismissed it for being too much fussy and hard to get code to compile (despite probably with practice the Rust rules should become quite simpler to follow), but Rust looks like the right language for me and I'd like the same qualities in the language that I like more (D). So in the end I don't know what's the best solution for D.


>> less implicit casts (because now we have the safe int(x) sytnax),
>
> I think D does very well with implicit casts.

I am not sure of that. Implicit casts cause some troubles, you can see this if you program for a while in a language with no or with very little implicit casts like Haskell, and F#.
In D we have some implicit casts also because the "cast(int)x" syntax is dangerous. But now we can write safe casts with the "int(x)" syntax, so there's less need of naked implicit casts.


>> And I'd still like built-in tuple syntax in D.
>
> [... Just one more feature ...] is the road to hell.

It's one more feature, and probably if D will last ten more years other features will be added to D.
Built-in tuples have a mostly intuitive semantics, and they help de-clutter the code. So the language gets a little more complex, but the code becomes a little simpler.

Bye,
bearophile
March 13, 2015
On Fri, 2015-03-13 at 10:31 -0700, Andrei Alexandrescu via Digitalmars-d
wrote:
[…]

> 
>    File("/tmp/a").byChunk(4096).joiner.startsWith(s)
> 
[…]

Conversely, this is exactly the sort of expression that Scala (and Haskell sort of, Haskell insists on function application syntax) are getting huge positive press for being able to write. As is Python. And Java. And C++.

-- 
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 13, 2015
On Friday, 13 March 2015 at 21:11:46 UTC, Alex Parrill wrote:
> On Friday, 13 March 2015 at 21:02:39 UTC, Almighty Bob wrote:
>> The language reference is pretty abysmal too. EG...

>> It has that feel all the way through. You go looking for things and they never seem to be where you expect, or they are so tersely explained, it feels like it's a reference for people already experts in D. Which is fine if that's what it's meant to be ... but if you want to attract new people you need a "guided tour" rather than a "technical spec".
>
> The language reference is a reference; it's supposed to be a
> technical spec, not a starting point. That said, the only links to starting points are the book (which isn't free) and the "Programming in D" pages at
> http://ddili.org/ders/d.en/index.html (which are now buried in the Articles tab)

Well I figured that was probably the case.

It's just not very smart to have that as the only obvious guide to the language on the home page.
March 13, 2015
On Friday, 13 March 2015 at 21:52:30 UTC, Almighty Bob wrote:
> On Friday, 13 March 2015 at 21:11:46 UTC, Alex Parrill wrote:
>> On Friday, 13 March 2015 at 21:02:39 UTC, Almighty Bob wrote:
>>> The language reference is pretty abysmal too. EG...
>
>>> It has that feel all the way through. You go looking for things and they never seem to be where you expect, or they are so tersely explained, it feels like it's a reference for people already experts in D. Which is fine if that's what it's meant to be ... but if you want to attract new people you need a "guided tour" rather than a "technical spec".
>>
>> The language reference is a reference; it's supposed to be a
>> technical spec, not a starting point. That said, the only links to starting points are the book (which isn't free) and the "Programming in D" pages at
>> http://ddili.org/ders/d.en/index.html (which are now buried in the Articles tab)
>
> Well I figured that was probably the case.
>
> It's just not very smart to have that as the only obvious guide to the language on the home page.

There's a "Books and Articles" dropdown on the frontpage, Ali's book is the first link.

It's very good. I refer to it constantly.
March 13, 2015
On Friday, 13 March 2015 at 22:02:42 UTC, weaselcat wrote:
> On Friday, 13 March 2015 at 21:52:30 UTC, Almighty Bob wrote:
>> On Friday, 13 March 2015 at 21:11:46 UTC, Alex Parrill wrote:
>>> On Friday, 13 March 2015 at 21:02:39 UTC, Almighty Bob wrote:
>>>> The language reference is pretty abysmal too. EG...
>>
>>>> It has that feel all the way through. You go looking for things and they never seem to be where you expect, or they are so tersely explained, it feels like it's a reference for people already experts in D. Which is fine if that's what it's meant to be ... but if you want to attract new people you need a "guided tour" rather than a "technical spec".
>>>
>>> The language reference is a reference; it's supposed to be a
>>> technical spec, not a starting point. That said, the only links to starting points are the book (which isn't free) and the "Programming in D" pages at
>>> http://ddili.org/ders/d.en/index.html (which are now buried in the Articles tab)
>>
>> Well I figured that was probably the case.
>>
>> It's just not very smart to have that as the only obvious guide to the language on the home page.
>
> There's a "Books and Articles" dropdown on the frontpage, Ali's book is the first link.
>
> It's very good. I refer to it constantly.

Wow, I failed at reading. Didn't realize that section was already
mentioned.
March 13, 2015
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 ...
March 13, 2015
On Friday, 13 March 2015 at 22:14:45 UTC, 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 ...

But most prefer labels. Did you dislike things like 'pure(false)' or' default:'? Just out of interest, since it is a bit offtopic.
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18