October 17, 2016
On Sunday, 16 October 2016 at 12:14:34 UTC, Adam D. Ruppe wrote:
> On Friday, 14 October 2016 at 21:18:45 UTC, Karabuta wrote:
>> The "!" is more trouble than good (IMO for the majority).  @Adam Roupe did a talk at previous DConf which he testifies to this.
>
> Couldn't be me, I don't think I ever talked about it... and I'm actually pro-!. It is a perfectly fine syntax and not hard to learn.

You said people ask you about it and you just say "its a compile-time argument". (check your talk, not you asking for help, people asking you :) )
October 17, 2016
On Monday, 17 October 2016 at 19:39:14 UTC, Benjiro wrote:
> On Thursday, 13 October 2016 at 19:06:26 UTC, Karabuta wrote:
>> How is a new visitor supposed to know "!" is for templates and not some complicated syntax?
>
> As a dlang newbie ( only started to learn a few days ago ), the example on the front page is just complex for new users.
>
> Its not a lack of knowledge ( 15+ years php, some C in high school,  Perl 3 years and some other languages over the years ) but i had no clue that "!" ( used a lot in examples ) is actually templates ( or macro's ). I was focused on other parts ( shared libraries creation & loading etc ) so never got around to some of the "basics". Just assumed it was a operator.
>
 I would suggest they remove all templates and make it its own example. It is easy to add more high-level features if you already know D, but think like someone who is coming from C or PHP or JavaScript.


* Basic functional/ranges example = map, filter, reduce
* basic helloworld = write the string "Hello, World!"
* Basic sort example
* basic maths example
* basic UFCS example

I also support removing Args and Input. Make things simple. People want to see clean syntax, because they just languages by syntax. We all at times perceive things by appearance first time.
October 18, 2016
On Thursday, 13 October 2016 at 19:06:26 UTC, Karabuta wrote:
> I assume the purpose for those demonstrations are to win the interest of the user as to how easy and clean D code can be. Then why;
>
> // Round floating point numbers
> import std.algorithm, std.conv, std.functional,
>     std.math, std.regex, std.stdio;
>
> alias round = pipe!(to!real, std.math.round, to!string);
> static reFloatingPoint = ctRegex!`[0-9]+\.[0-9]+`;
>
> void main()
> {
>     // Replace anything that looks like a real
>     // number with the rounded equivalent.
>     stdin
>         .byLine
>         .map!(l => l.replaceAll!(c => c.hit.round)
>                                 (reFloatingPoint))
>         .each!writeln;
> }
>
> How is a new visitor supposed to know "!" is for templates and not some complicated syntax?

I think the point of the examples is to show D at its most expressive/concise. The thing is that if you presented "Hello, world!" a lot of people who come from other languages would complain about how D doesn't seem to have chaining, mapping, templates etc. and that the examples are too easy, blah blah. We've had loads of discussions about this.

Also, it's good to show people how D code should look like right from the start. Whenever I (have to) learn a new language, I look immediately at the best practices trying to avoid awkward code.
October 18, 2016
On Tuesday, 18 October 2016 at 09:26:56 UTC, Chris wrote:
> I think the point of the examples is to show D at its most expressive/concise. The thing is that if you presented "Hello, world!" a lot of people who come from other languages would complain about how D doesn't seem to have chaining, mapping, templates etc. and that the examples are too easy, blah blah. We've had loads of discussions about this.
>
> Also, it's good to show people how D code should look like right from the start. Whenever I (have to) learn a new language, I look immediately at the best practices trying to avoid awkward code.

The issue is, that in order to understand the example, you are already required to have a knowledge of the language.

I can only use myself as a example. Only started to really use D a few days ago because i have a specific project. I instantly look for the methods that interest me, totally bypassing half the manual. The ! looked like a operator and not a template.

To show you how much a nice example flow matters: a month or 3 ago ( because of this future project ) i started to look at several languages: Go, Nim, Haxe, etc...

Notice something missing? Yes... i knew about D but totally skipped it for two reasons. Its the same reasons as to why Rust got skipped. I did not like the syntax example's. And in case of D, the whole community issue with D1 vs D2 in several reddit topics that still gets propagated.

* Started with Go. Hated it.
* Tried Nim. Not bad but lacking in community, only one real core developer.
* Crystal. Not bad again but too much Ruby style focused. Still very young project.
* Haxe. Lots of options for multi platform ( GUI/Gaming/etc ) but very bad support for what i needed specifically ( not without going with Cppia or neko = massive performance hit compared to pure C/C++ ).

* D ... Frankly, D for me was: "why the hell not give it a try, i am running out of languages".

And withing 10 minutes i found the solution for what i needed. And been playing around with that. And spend hours playing all the DCon2016 youtube video's ( so much material to see ) etc...

The example on the front page, simple scared me away at first, because its so much "Perl all over again". One liner hell, with unknown "operators".

The moment you start working with D, its more: Hey, this is actually C/C++ style but with enhancements. But the example on the front page ( and several more on the net, focus on more advanced solutions and looked too much specialized ).

I can not stress this enough but as a new user that has been shopping around, D really scared me away at first because of the two mentioned points.

Maybe its just me OCD as a web developer but if you can not convince me in a few seconds after opening your website, i simply look at other websites first. Think of developers as consumers. If you can not convince them to stay and look deeper within seconds, you lose out on "converts".

Simple examples:

http://nim-lang.org/
-> Withing a few slides you go from simple to more advanced examples. But you already get a good feel about the language.

https://crystal-lang.org/
-> Ooo, nice ... only a few lines to get a http server started. Nice ...

https://haxe.org/
-> Again ... a simple example that shows the language. Not the advanced features.

That is also the reason why i mentioned: Start with a simple ( does not need to be "Hello world" ) example but allow more examples to show the real power. But do not start with more power examples with one-liners and templates ( what nobody knows ) as the first impression because people make up there mind within seconds.

Its the only real big criticism on the whole D website. For the rest its actually very good. The Learn is good but please remove the EYE button on the right side next to "run", it changes the layout / removes the code, its confusing. Simple is better.
October 18, 2016
On Tuesday, 18 October 2016 at 10:04:35 UTC, Benjiro wrote:

>
> The issue is, that in order to understand the example, you are already required to have a knowledge of the language.
>
> I can only use myself as a example. Only started to really use D a few days ago because i have a specific project. I instantly look for the methods that interest me, totally bypassing half the manual. The ! looked like a operator and not a template.
>
> To show you how much a nice example flow matters: a month or 3 ago ( because of this future project ) i started to look at several languages: Go, Nim, Haxe, etc...
>
[snip]

The example on the start page even says what it's doing and anyone familiar with Javascript, Ruby (and now even Java), among other languages, will more or less understand it:

`void main()
{
    // Replace anything that looks like a real
    // number with the rounded equivalent.
    stdin
        .byLine
        .map!(l => l.replaceAll!(c => c.hit.round)
                                (reFloatingPoint))
        .each!writeln;
}
`
People are increasingly looking for this type of thing. I for my part would be delighted to find one liners like that. Javascript also has `map` and `filter`, which was a good addition to the language.

If you want basic code and step by step examples, go to "Learn", which is what I do when I look at other languages. "Getting started", "Learn", "Tutorial", whatever.

Although the first impression counts, I don't wholly subscribe to the "2 seconds" attention span thing. If you're seriously interested in finding a good tool (i.e. a programming language) for your purposes, then you have to invest more than a few minutes anyway, regardless. As to Nim and Haxe, you have to spend some time on the respective pages to get to useful stuff (like language features etc.) - as on any other homepage, so I don't see your point there.

Also, as I've already said, people might look for stuff like `stdin.byLine...` and if they don't find it may think "Just another C-clone, boring". I bet you a pint that people would post here complaining that we didn't show them stuff like `map!(a => ).filter...` on the start page.

tl;dr: You have to invest time in learning how to use a new tool anyway. The example on the start page should not be the main argument for or against a language.
October 18, 2016
When people have a choice between a multitude of website, programming languages, ... people make choices fast.

Personally moved over 5 different programming languages in 3 months time trying to find the ideal match. So my attention span is not exactly small. But when faced with a entire series of "next gen" languages like Go, Haxe, Nim, ... you simple make choice fast.

Its not obvious to people already long time into a language, as to what small details can push people to a language.

Its exactly that whole template & java like one liners that made me think: "great, another java wannabe". It can give the impression the language is designed around that feature.  And yes, the whole negative forum posts about split community, D1 vs D2. Some people ranting about feature lacking. Some people ranting about GC. Those also did not help to push me to D. Why wast time on something, when there are other alternatives to try out first? Do you understand now?

And i am not joking around, when stating that the syntax and negative posts regarding D, drove me towards other languages before coming back to D as a "whats left, that might fit my plans" attitude. Most people when they make up there minds, they never come back and get stuck in those other languages.


As you state, your showing features that some people may be explicated looking for so why not show a even more complicated example that shows even more of D features. Scare away even more beginners. *lol*. Just kidding ;)

If one has multiple examples on the website, starting simple to more complex, that can easily be selected. There is nothing wrong with a proposal like that. Its not going to drive away anybody looking for a C/C++ enhanced language because its all over the front page. But it just may help a few people stay longer. The Learn section takes longer to make up your mind because its a full tutorial, then one minute looking at a few examples if you like the style ;)

And in all honesty, this discussion did point out another thing lacking from the website: There is no easily visible link where people can see more example ( like Rosetta Code ).


So the suggestions are:

1. Home page:
* Add more example to the home page.
* Switchable with buttons like [1][2][3][Run].
* Remove the Arg/Inc buttons, they just confuse people.

2. On the learn page
* Remove the Eye button. Again, has no use but confuses people ( or place it somewhere else ).
* Place another navigation link in the top right buttons. So you do not have the whole navigation line "< Run D program locally 4 / 4 Imports and modules >" constantly shifting around. Its annoying.

3. Add a example page ( a la Rosetta Code ) with a clear link on the home page. The tour/Learn does not count.


Like i said, my job is website design and its easy as a outsider to see what points can confuse people ( because hell, they confused me *lol* ). The website is actually one of the better websites for "next gen" languages that i have seen. It just needs a few minor tweaks left and right to increase "usability" ( from a new visitor point of view ).

I said it before, think of Dlang as a commercial product. Not just as a community project that will draw in already mature programmers looking for a C/C++ alternative. Because you simple limit your market potential that way. Why pick D when you have C++ already or the dozen alternative languages. Marketing is not a easy thing to do and a lot is in the details.
October 18, 2016
On Monday, 17 October 2016 at 20:13:19 UTC, Karabuta wrote:
>  I would suggest they remove all templates and make it its own example.


> * Basic functional/ranges example = map, filter, reduce

Templates

> * basic helloworld = write the string "Hello, World!"

Template (implicit)

> * Basic sort example

Template

> * basic maths example

Template at times (implicit)

> * basic UFCS example

Works with templates

It is very hard to use D and not instantiate a template for the "basics."

October 18, 2016
On Tuesday, 18 October 2016 at 15:41:29 UTC, Jesse Phillips wrote:
> On Monday, 17 October 2016 at 20:13:19 UTC, Karabuta wrote:
>>  I would suggest they remove all templates and make it its own example.
>
>
>> * Basic functional/ranges example = map, filter, reduce
>
> Templates
>
>> * basic helloworld = write the string "Hello, World!"
>
> Template (implicit)
>
>> * Basic sort example
>
> Template
>
>> * basic maths example
>
> Template at times (implicit)
>
>> * basic UFCS example
>
> Works with templates
>
> It is very hard to use D and not instantiate a template for the "basics."

I've shown this to a colleague of mine a few days ago: he was super confused by the ! operator. Then I told him it was D's syntax for templates and everything made sense.

You can change the example to (here i left the same code of the original one, but I agree with what the other said about it)

`// Round floating point numbers
import std.algorithm, std.conv, std.functional,
    std.math, std.regex, std.stdio;

alias round = pipe!(to!real, std.math.round, to!string);
static reFloatingPoint = ctRegex!`[0-9]+\.[0-9]+`;

void main()
{
    // Replace anything that looks like a real
    // number with the rounded equivalent.
    stdin
        .byLine
        .map!(l => l.replaceAll!(c => c.hit.round)
                                (reFloatingPoint))
        .each!writeln;
`
Edit|Args|Input|Run|Explain

If someone click on Explain, show
"
This example shows how easy it is to perform operations on data in D in a quick overview of some general concepts which are widespread in D.
You can see the byLine function being called without parenthesis because it doesn't take any parameters in this case, the map[1] template being used with UFCS [2], taking a lambda as templated parameter with D template syntax (template_name!(template_parameters)(runtime_parameters) )[3], the "each" template called with writeln as template parameter without parenthesis because it's the only parameter taken.
To learn more about pipelining in D check out [4]

[1] https://dlang.org/phobos/std_algorithm_iteration.html#.map
[2] http://ddili.org/ders/d.en/ufcs.html
[3] https://dlang.org/spec/template.html
[4] page about that
"

Having 10 lines explaining what's going on in the code and providing links to understand better can hook up a new user way better than letting them do guess work. Moreover you can start showing the documentation already, so they can start to be familiar with where to search stuff
October 18, 2016
On Tuesday, 18 October 2016 at 10:04:35 UTC, Benjiro wrote:
> On Tuesday, 18 October 2016 at 09:26:56 UTC, Chris wrote:

> The issue is, that in order to understand the example, you are already required to have a knowledge of the language.
>
> I can only use myself as a example. Only started to really use D a few days ago because i have a specific project. I instantly look for the methods that interest me, totally bypassing half the manual. The ! looked like a operator and not a template.
>
> To show you how much a nice example flow matters: a month or 3 ago ( because of this future project ) i started to look at several languages: Go, Nim, Haxe, etc...
>
> Notice something missing? Yes... i knew about D but totally skipped it for two reasons. Its the same reasons as to why Rust got skipped. I did not like the syntax example's. And in case of D, the whole community issue with D1 vs D2 in several reddit topics that still gets propagated.
>

They will not understand. Those are the UX stuff you learn when you are a web designer/developer.

It is easy to not understand the impact when your already know D. Test it on a new user and see. Moreover, unless D is not meant to be a first programming language to learn, then we are far from gaining new adopters with the current information. The tour examples are clearly written by people who have less/limited/lacking teaching skills.

How do you win a visitor's interest in 2-5 seconds?

October 19, 2016
On Tuesday, 18 October 2016 at 12:49:55 UTC, Benjiro wrote:
> When people have a choice between a multitude of website, programming languages, ... people make choices fast.
[snip]

There are three things here. First, you initially made your decision not to use D based not only on the homepage (one example at that), but on the discussion about D1/D2 and GC. So it was clearly not only the homepage that turned you off D. Afik, the D1/D2 discussion is no longer an issue. GC is an ongoing issues, but there are ways around it.

Second, what users expect of a homepage has changed over the years and is still changing. I know, because I've designed web sites, both on behalf of a company (I wasn't the developer) and I've also programmed some of them myself. Every two or three years there's a new latest fashion that "Oh my God, no-one can live without!". After all, the PR industry and web designers want to keep themselves in a job. I don't think it's necessary for the D community to follow every latest trend in web design and needlessly bind resources. Instead, the D site should focus on the fast and easy accessibility of information (Tutorial, Docs, Specs, the "D.learn" forum). It doesn't matter, if we use the latest fancy gradients or slides. I bet you that the day will come when PR/web design companies will say "Slides are too confusing, the user needs to focus on one thing at a time! We'll revamp your web site for only €60,000! Deal?" Web site design will keep changing. No need to join the herd at every "bahhh" you hear.

NB: As to other languages, I don't find their web pages particularly attractive. Their design takes up the whole screen without saying anything substantial. I have to click my way through them to find useful information. What turns me off other languages, I often only discover in the "small print" of the specs, not on the start page ;)

Third, you came back to D after the negative first impression you had of it. Great. That's interesting and it goes to show that a fancy homepage with "cool" examples and nice PR talk is not all that counts. Using the language is what counts, nothing else. Only in this way can you find out, if it works for you or not.

I agree that at times the D community could be a bit more professional about promoting D, but things have improved a lot. We have a lot of people who dedicated their time to improving the homepage and the image of D in general. Now there is the D Foundation to bundle all efforts, be it development or promoting of D.

So bear with us! It can only get better.

PS You will see a lot of discussions - and sometimes negativity - on the forum. But that's only because in D it happens publicly. Other languages are just better at hiding it.

PPS The website can be found at https://github.com/dlang/dlang.org
Feel free to make pull requests!