www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Why are homepage examples too complicated?

reply Karabuta <karabutaworld gmail.com> writes:
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?
Oct 13 2016
next sibling parent reply Meta <jared771 gmail.com> writes:
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?
How's a new user supposed to know <> is for templates when looking at a C++ example? They don't; it's just something that has to be learned, or they know it because other languages use a similar syntax. Rust uses ! for macro invocation, and I imagine that creeps into some of their examples (OTOH, anything that prints output). Templates are such an integral part of D that any non-trivial example can't get around not using them.
Oct 13 2016
parent Karabuta <karabutaworld gmail.com> writes:
On Thursday, 13 October 2016 at 19:30:30 UTC, Meta wrote:
 On Thursday, 13 October 2016 at 19:06:26 UTC, Karabuta wrote:
 How's a new user supposed to know <> is for templates when 
 looking at a C++ example? They don't; it's just something that 
 has to be learned, ...
Does that make it a standard for everyone to follow?
Oct 13 2016
prev sibling next sibling parent cym13 <cpicard openmailbox.org> writes:
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?
You are definitely taking the problem in reverse here IMHO. The goal of such example isn't to get the user to get every little bit about it like “What does ! mean?”. It is impossible to explain each detail of the syntax in such a short format and that would only confuse the user to force everything in it anyway. The goal of such example is for users to feel the general syntax when applied to an example expressive enough that they can follow it and infer for themselves the general meaning of the syntax. The goal is to have them think “Oh, that looks like a sequence of instructions on stdin.. byLine obviously mean that we read it by line, the map part isn't that easy to follow ok, but the last part each!writeln looks like we're writing each of a thing to a line... ok, so the actual replacement must happen in the map, yeah I see it, and there is the round part too so map must be some iterator thingy... Ok, I mostly get it.” because if they do then it's where they get the confidence that they can red the language, that it feels "obvious" enough for them to use. That's what builds the idea of an intuitive language. Explaining how the code does what it does is definitely not the point here, knowing that ! is used for templates brings nothing. It could be used for any kind of other data structure the fact that “each!writeln” is understood as “write each line” is what really counts. Maybe the example is poorly choosen and doesn't get new users to that point, but my experience showing it to friends is that it's definitely not that bad.
Oct 13 2016
prev sibling next sibling parent reply Guillaume Piolat <first.last gmail.com> writes:
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 agree, something friendly and familiar would be called for. Instead we have weird float-rounding programs. The goal of such program should be to push the reader to continue reading by apealing to familiarty. I think this strongly conveys the message that D is complicated and "not for me". See also: https://golang.org/ https://www.rust-lang.org/fr-FR/ https://crystal-lang.org/ https://www.ruby-lang.org/fr/ https://www.python.org/ Do you notice something? The language branded as "simple" have the simplest landing page programs.
Oct 13 2016
parent reply Karabuta <karabutaworld gmail.com> writes:
On Thursday, 13 October 2016 at 22:12:42 UTC, Guillaume Piolat 
wrote:
 On Thursday, 13 October 2016 at 19:06:26 UTC, Karabuta wrote:
 I agree, something friendly and familiar would be called for. 
 Instead we have weird float-rounding programs.

 The goal of such program should be to push the reader to 
 continue reading by apealing to familiarty. I think this 
 strongly conveys the message that D is complicated and "not for 
 me".

 See also:
 https://golang.org/
 https://www.rust-lang.org/fr-FR/
 https://crystal-lang.org/
 https://www.ruby-lang.org/fr/
 https://www.python.org/

 Do you notice something? The language branded as "simple" have 
 the simplest landing page programs.
Apparently someone here thinks showing CPU internals is the best way to teach a beginner programming for him to write efficient code from learning stage. The art of teaching does not work that way in the real world. The "!" is more trouble than good (IMO for the majority). Adam Roupe did a talk at previous DConf which he testifies to this.
Oct 14 2016
parent reply Adam D. Ruppe <destructionator gmail.com> writes:
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.
Oct 16 2016
parent Karabuta <karabutaworld gmail.com> writes:
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 :) )
Oct 17 2016
prev sibling next sibling parent reply Nick Treleaven <nick geany.org> writes:
On Thursday, 13 October 2016 at 19:06:26 UTC, Karabuta wrote:
     // 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;
I think this example is a bit awkward for D newbies to decipher. I think here we are showing D's ctRegex; dropping the functional map and lambdas would make this more universally understood. Using matchAll rather than replaceAll makes the example a bit simpler too: // Print a list of rounded decimal numbers import std.conv, std.functional, std.math, std.regex; // Chain functions together to round a string parsed as a real number alias roundString = pipe!(to!real, std.math.round, to!string); // Create a compile-time Regular Expression to match decimal numbers static decimalRegex = ctRegex!`[0-9]+\.[0-9]+`; void main() { import std.stdio; // Iterate standard input lines foreach (line; stdin.byLine()) { // Find all decimal matches foreach (m; line.matchAll(decimalRegex)) { m.hit.roundString().writeln(); // round number and print } } }
Oct 16 2016
next sibling parent Nick Treleaven <nick geany.org> writes:
On Sunday, 16 October 2016 at 16:07:19 UTC, Nick Treleaven wrote:
 // Chain functions together to round a string parsed as a real 
 number
 alias roundString = pipe!(to!real, std.math.round, to!string);
In fact if we're just printing the rounded numbers, we can drop to!string and inline roundString. If we want a functional example, let's keep it separate from the regex stuff.
Oct 16 2016
prev sibling parent reply Nick Treleaven <nick geany.org> writes:
On Sunday, 16 October 2016 at 16:07:19 UTC, Nick Treleaven wrote:
 I think this example is a bit awkward for D newbies to 
 decipher. I think here we are showing D's ctRegex; dropping the 
 functional map and lambdas would make this more universally 
 understood.
https://github.com/dlang/dlang.org/pull/1500
Oct 20 2016
next sibling parent Chris <wendlec tcd.ie> writes:
On Thursday, 20 October 2016 at 11:38:04 UTC, Nick Treleaven 
wrote:
 On Sunday, 16 October 2016 at 16:07:19 UTC, Nick Treleaven 
 wrote:
 I think this example is a bit awkward for D newbies to 
 decipher. I think here we are showing D's ctRegex; dropping 
 the functional map and lambdas would make this more 
 universally understood.
https://github.com/dlang/dlang.org/pull/1500
Sounds reasonable. What about adding code for hardcore systems programmers too? Some flashy low-level stuff.
Oct 20 2016
prev sibling parent reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 10/20/2016 07:38 AM, Nick Treleaven wrote:
 On Sunday, 16 October 2016 at 16:07:19 UTC, Nick Treleaven wrote:
 I think this example is a bit awkward for D newbies to decipher. I
 think here we are showing D's ctRegex; dropping the functional map and
 lambdas would make this more universally understood.
https://github.com/dlang/dlang.org/pull/1500
I think it would be best if we kept both. -- Andrei
Oct 20 2016
next sibling parent Chris <wendlec tcd.ie> writes:
On Thursday, 20 October 2016 at 14:04:06 UTC, Andrei Alexandrescu 
wrote:
 On 10/20/2016 07:38 AM, Nick Treleaven wrote:
 On Sunday, 16 October 2016 at 16:07:19 UTC, Nick Treleaven 
 wrote:
 I think this example is a bit awkward for D newbies to 
 decipher. I
 think here we are showing D's ctRegex; dropping the 
 functional map and
 lambdas would make this more universally understood.
https://github.com/dlang/dlang.org/pull/1500
I think it would be best if we kept both. -- Andrei
Actually, the whole example would be easier to understand, if there were more comments. I.e. explain what `pipe!` does and what `ctRegex` is. It's much clearer in the Docs[1]: // Read an entire text file, split the resulting string in // whitespace-separated tokens, and then convert each token into an // integer int[] a = pipe!(readText, split, map!(to!(int)))("file.txt"); In general I find it helpful, when there are comments in example snippets. Some examples from the Docs would actually be quite good for newbies. Maybe we can harvest snippets there.
Oct 20 2016
prev sibling parent reply Karabuta <karabutaworld gmail.com> writes:
On Thursday, 20 October 2016 at 14:04:06 UTC, Andrei Alexandrescu 
wrote:
 On 10/20/2016 07:38 AM, Nick Treleaven wrote:
 On Sunday, 16 October 2016 at 16:07:19 UTC, Nick Treleaven 
 wrote:
 I think this example is a bit awkward for D newbies to 
 decipher. I
 think here we are showing D's ctRegex; dropping the 
 functional map and
 lambdas would make this more universally understood.
https://github.com/dlang/dlang.org/pull/1500
I think it would be best if we kept both. -- Andrei
Test using bottom- up approach. Test on a newbie.
Oct 20 2016
parent reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 10/20/2016 03:48 PM, Karabuta wrote:
 On Thursday, 20 October 2016 at 14:04:06 UTC, Andrei Alexandrescu wrote:
 On 10/20/2016 07:38 AM, Nick Treleaven wrote:
 On Sunday, 16 October 2016 at 16:07:19 UTC, Nick Treleaven wrote:
 I think this example is a bit awkward for D newbies to decipher. I
 think here we are showing D's ctRegex; dropping the functional map and
 lambdas would make this more universally understood.
https://github.com/dlang/dlang.org/pull/1500
I think it would be best if we kept both. -- Andrei
Test using bottom- up approach. Test on a newbie.
We ought to test on different newbies with different sensibilities. The PR replaces one style of doing things with another. For some the first style may be more pleasant than the second ("you mean I need to go back to for loops now?") etc. -- Andrei
Oct 20 2016
parent reply Karabuta <karabutaworld gmail.com> writes:
On Thursday, 20 October 2016 at 19:52:32 UTC, Andrei Alexandrescu 
wrote:
 On 10/20/2016 03:48 PM, Karabuta wrote:
 On Thursday, 20 October 2016 at 14:04:06 UTC, Andrei 
 Alexandrescu wrote:
 On 10/20/2016 07:38 AM, Nick Treleaven wrote:
 On Sunday, 16 October 2016 at 16:07:19 UTC, Nick Treleaven 
 wrote:
 [...]
https://github.com/dlang/dlang.org/pull/1500
I think it would be best if we kept both. -- Andrei
Test using bottom- up approach. Test on a newbie.
We ought to test on different newbies with different sensibilities. The PR replaces one style of doing things with another. For some the first style may be more pleasant than the second ("you mean I need to go back to for loops now?") etc. -- Andrei
Generally. All examples you assume will be effective for beginners.
Oct 20 2016
parent reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 10/20/2016 04:16 PM, Karabuta wrote:
 On Thursday, 20 October 2016 at 19:52:32 UTC, Andrei Alexandrescu wrote:
 On 10/20/2016 03:48 PM, Karabuta wrote:
 On Thursday, 20 October 2016 at 14:04:06 UTC, Andrei Alexandrescu wrote:
 On 10/20/2016 07:38 AM, Nick Treleaven wrote:
 On Sunday, 16 October 2016 at 16:07:19 UTC, Nick Treleaven wrote:
 [...]
https://github.com/dlang/dlang.org/pull/1500
I think it would be best if we kept both. -- Andrei
Test using bottom- up approach. Test on a newbie.
We ought to test on different newbies with different sensibilities. The PR replaces one style of doing things with another. For some the first style may be more pleasant than the second ("you mean I need to go back to for loops now?") etc. -- Andrei
Generally. All examples you assume will be effective for beginners.
We can't assume all beginners come from imperative languages. D beginners may come from languages where the idiomatic way of doing things is by means of pipelines. Generally it's not worth debating this because there's so little evidence to dwell on - please let's keep both and move with our lives. Thanks! -- Andrei
Oct 20 2016
parent reply Chris <wendlec tcd.ie> writes:
On Thursday, 20 October 2016 at 21:52:09 UTC, Andrei Alexandrescu 
wrote:
 On 10/20/2016 04:16 PM, Karabuta wrote:
 We can't assume all beginners come from imperative languages. D 
 beginners may come from languages where the idiomatic way of 
 doing things is by means of pipelines. Generally it's not worth 
 debating this because there's so little evidence to dwell on - 
 please let's keep both and move with our lives. Thanks! -- 
 Andrei
Today many people don't even want to see a for-loop. What we could do, though, is to give an example of each common or "expected" feature (OOP, functional, concurrency, memory model etc.), so that people see immediately that they can do A, B _and_ C in D :-)
Oct 21 2016
parent reply Mark <smarksc gmail.com> writes:
On Friday, 21 October 2016 at 10:24:40 UTC, Chris wrote:
 On Thursday, 20 October 2016 at 21:52:09 UTC, Andrei 
 Alexandrescu wrote:
 On 10/20/2016 04:16 PM, Karabuta wrote:
 We can't assume all beginners come from imperative languages. 
 D beginners may come from languages where the idiomatic way of 
 doing things is by means of pipelines. Generally it's not 
 worth debating this because there's so little evidence to 
 dwell on - please let's keep both and move with our lives. 
 Thanks! -- Andrei
Today many people don't even want to see a for-loop. What we could do, though, is to give an example of each common or "expected" feature (OOP, functional, concurrency, memory model etc.), so that people see immediately that they can do A, B _and_ C in D :-)
I second that. Also, it may be a good idea to simply use classical algorithms (binary search, quicksort, etc.), written in "D style", as examples. The typical visitor is probably familiar with these algorithms and thus the foreign syntax won't be as scary. It also puts the syntax in a context that the visitor is already familiar with, so there is a good chance that he'll deduce its meaning even without supplementary comments. For instance, TDPL has the following implementation of binary search in its introductory chapter: bool binarySearch(T)(T[] input, T value) { while (!input.empty) { auto i = input.length / 2; auto mid = input[i]; if (mid > value) input = input[0 .. i]; else if (mid < value) input = input[i + 1 .. $]; else return true; } return false; } Nothing too fancy, but it's a good example of how array slicing in D helps make the code cleaner, shorter and easier to understand.
Oct 21 2016
parent Chris <wendlec tcd.ie> writes:
On Friday, 21 October 2016 at 12:31:00 UTC, Mark wrote:
 I second that.

 Also, it may be a good idea to simply use classical algorithms 
 (binary search, quicksort, etc.), written in "D style", as 
 examples. The typical visitor is probably familiar with these 
 algorithms and thus the foreign syntax won't be as scary. It 
 also puts the syntax in a context that the visitor is already 
 familiar with, so there is a good chance that he'll deduce its 
 meaning even without supplementary comments.

 For instance, TDPL has the following implementation of binary 
 search in its introductory chapter:

 bool binarySearch(T)(T[] input, T value) {
    while (!input.empty) {
       auto i = input.length / 2;
       auto mid = input[i];
       if (mid > value) input = input[0 .. i];
       else if (mid < value) input = input[i + 1 .. $];
       else return true;
    }
    return false;
 }

 Nothing too fancy, but it's a good example of how array slicing 
 in D helps make the code cleaner, shorter and easier to 
 understand.
Yeah, I agree. Use common tasks everybody is familiar with. Sorting, searching, string handling.
Oct 21 2016
prev sibling next sibling parent reply Benjiro <benjiro benjiro.com> writes:
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. Also, first example using regex? And the overuse of one-liners. Lets not start with so much one liners / merged lines, it makes something simple look more complex. Its great for more seasoned programmers but its less readable for people with little or first time experience. Another issue is the "Edit/Args/Input/Run". First thing a person does is press "Run" but then your wondering, wait? What is that result? Where does it come from? Lost 20 seconds figuring out where it was hiding. My suggestions: A. Remove Args, Remove Input ( reworked / make any input inline in the code ). Simple is better. B. Use multiple examples. Place buttons below instead of Args/Input [1 2 3 .. 8 Run]. Examples: 1. Hello World 2. ... 3. Templates 4. This Regex example ( reworked for inline input ) 5. C/C++ Integration example 6. ... ... Show parts of the language its advantages. Its like drugs. Give people a taste and get them hooked for life. >:) Just my 2 cents on the topic.
Oct 17 2016
parent reply Karabuta <karabutaworld gmail.com> writes:
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.
Oct 17 2016
parent reply Jesse Phillips <Jesse.K.Phillips+D gmail.com> writes:
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."
Oct 18 2016
parent MakersF <lfc morz.com> writes:
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
Oct 18 2016
prev sibling parent reply Chris <wendlec tcd.ie> writes:
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.
Oct 18 2016
parent reply Benjiro <benjiro benjiro.com> writes:
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.
Oct 18 2016
next sibling parent reply Chris <wendlec tcd.ie> writes:
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.
Oct 18 2016
parent reply Benjiro <benjiro benjiro.com> writes:
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.
Oct 18 2016
parent Chris <wendlec tcd.ie> writes:
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!
Oct 19 2016
prev sibling parent reply Karabuta <karabutaworld gmail.com> writes:
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?
Oct 18 2016
next sibling parent reply Benjiro <benjiro benjiro.com> writes:
On Tuesday, 18 October 2016 at 20:51:24 UTC, Karabuta wrote:
 They will not understand. Those are the UX stuff you learn when 
 you are a web designer/developer.
True. Anybody can make a website. A website that is efficient, takes time. A stupid travel booking website took over a year with constant meeting to design around here. The result is a efficient design but it takes time.
 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.
Its the same issue with other languages. Go has the advantage of being a big brand name thanks to Google and that is a big part of its success. When looking at Nim or other languages, you always see the issue of elitist thinking ( its not a insult ). People who are so used to the language, that they do not understand how some of there code example are too complex for beginners. I ended ordering Ali's book "Programming in D" yesterday because after seeing his Youtube Dcon2016 video, he knows how to explain topics to users. His multi thread youtube video was very informative yet, relative to the topic simple to understand. And his book reviews reflect this also. No offense to Andrei, while his is funny, he is simply thinking above my head. Walter is actually better at explain things. I have no problem admitting that my skills are horrible after being stuck for the last 15 years in PHP ( and perl a few years ). It also means that when something is above my head, i instantly notice that.
 The tour examples are clearly written by people who have 
 less/limited/lacking teaching skills.
The Learn / Tour is not bad. Far from it. Its just too technical. Having dealt with a series of alternative languages, the dlang website is well designed and more user friendly then a lot like nim, crystal ... But the dlang site is too much designed around people who already have a C/C++ interest. Those same type of people that you will NOT easily convert to D because they already have powerful tools available. There are a few reviews about D online, that state the same issue. D is more powerful then C++ but converting people from that mature ecosystem, even with C++ its flaws, is difficult.
 How do you win a visitor's interest in 2-5 seconds?
By using simple to the point communication. = First time programmers: * A simple example. Lets say a bit more advanced then "Hello World" but not so advanced that we trow template at there face. = Somebody with a PHP/Scripting background ( big potential group ): * A http server example ( vibe.d? ). With some benchmarks where it beats PHP/Apache ( people are stat whores *lol* ). Etc ... Its the same reason why the home page needs a multi-tab example sheet. People see first example, its interesting but they want to see more. They click on tab 2, tab 3, ... going down the examples. Each showing more & more the power of D. Or even better, the tabs rotate every x seconds if you are not holding your mouse over them. Going full C++ hog on the first example, simply limits your market potential. If a C++ programmer comes here, there is less change that he is pushed away from a first simple language example, then the reverse. Where a non-advanced programmer comes here and is confronted with a more advanced example. The fact that D supports a lot of templates is besides the point. Showing this is something in maybe the 3 or 4th example. You always first start with the basics. ---------- ... Same reason why i mention a example page, where you can see a multitude of techniques in one go. Something to "Wet the beak" of people who first get introduced to the website. ---------- Another issue i noticed is the twitter channel. Too much Asian language posts. Its pushing away information for all the rest who do not speak Mandarin/Japanese? It simply does not present cleanly. There needs to be some moderating going on there. Like i said, this is all from my perspective as a D newbie. And i am not afraid to say that i am a D newbie :)
Oct 19 2016
next sibling parent reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 10/19/16 5:28 AM, Benjiro wrote:
 No offense to Andrei, while his is funny, he is simply thinking above my
 head. Walter is actually better at explain things.
None taken! And thanks for your feedback. I think you have an easy means of helping progress here. Simply send more code snippets for the homepage (the kind you believe would have helped you). Post them here or aggregate them in a bugzilla issue and we'll add them to the rotating pool. We clearly need more examples of varying difficulties. -- Andrei
Oct 19 2016
parent reply rikki cattermole <rikki cattermole.co.nz> writes:
On 20/10/2016 12:08 AM, Andrei Alexandrescu wrote:
 On 10/19/16 5:28 AM, Benjiro wrote:
 No offense to Andrei, while his is funny, he is simply thinking above my
 head. Walter is actually better at explain things.
None taken! And thanks for your feedback. I think you have an easy means of helping progress here. Simply send more code snippets for the homepage (the kind you believe would have helped you). Post them here or aggregate them in a bugzilla issue and we'll add them to the rotating pool. We clearly need more examples of varying difficulties. -- Andrei
On that note, maybe we should setup a 'real code' pool so people can see real code, preferably on a few files big that does a specific but useful task.
Oct 19 2016
parent Chris <wendlec tcd.ie> writes:
On Wednesday, 19 October 2016 at 11:30:03 UTC, rikki cattermole 
wrote:
 On 20/10/2016 12:08 AM, Andrei Alexandrescu wrote:

 On that note, maybe we should setup a 'real code' pool so 
 people can see real code, preferably on a few files big that 
 does a specific but useful task.
Actually, that'd be great.
Oct 19 2016
prev sibling parent reply Karabuta <karabutaworld gmail.com> writes:
On Wednesday, 19 October 2016 at 09:28:28 UTC, Benjiro wrote:
 On Tuesday, 18 October 2016 at 20:51:24 UTC, Karabuta wrote:
 [...]
True. Anybody can make a website. A website that is efficient, takes time. A stupid travel booking website took over a year with constant meeting to design around here. The result is a efficient design but it takes time. [...]
On Wednesday, 19 October 2016 at 09:28:28 UTC, Benjiro wrote: I like this guy :) (You are the first person I ever liked here)
Oct 19 2016
parent reply Chris <wendlec tcd.ie> writes:
On Wednesday, 19 October 2016 at 20:46:08 UTC, Karabuta wrote:
 On Wednesday, 19 October 2016 at 09:28:28 UTC, Benjiro wrote:
 On Tuesday, 18 October 2016 at 20:51:24 UTC, Karabuta wrote:
 [...]
True. Anybody can make a website. A website that is efficient, takes time. A stupid travel booking website took over a year with constant meeting to design around here. The result is a efficient design but it takes time. [...]
On Wednesday, 19 October 2016 at 09:28:28 UTC, Benjiro wrote: I like this guy :) (You are the first person I ever liked here)
I.e. "He agrees with me, therefore I like him!" One year of meetings to design a website does not necessarily mean the site's good or that it has to take at least a year until you have a presentable website. Designing a website for a company means that the marketing knobs feel they have to throw in their 2 cents and want them acted upon or they block the whole process - then at the end, all of a sudden the boss - who never cared for the website - wants to have a look too and here we go again... We're talking about font-sizes, gradient colors, button 2px to the left, company logo bigger/smaller etc, not about the page logic. Of course, because they know nothing about programming they go by what they see and try to make a contribution there, just for the sake of it. Unfortunately, it is often forgotten that each website needs a different, unique approach. Getting inspiration from other websites is good, trying to copy them is not a good idea, because it will never serve your purpose optimally. The real craftsmanship behind a website is mastering the various technologies that don't work smoothly together (HTML, JS, PHP, forms, requests, server side stuff, browsers, data bases). Web design is 90% page logic, 10% inspiration.
Oct 20 2016
parent reply Benjiro <benjiro benjiro.com> writes:
On Thursday, 20 October 2016 at 09:10:10 UTC, Chris wrote:
 I.e. "He agrees with me, therefore I like him!" One year of 
 meetings to design a website does not necessarily mean the 
 site's good or that it has to take at least a year until you 
 have a presentable website.
Sorry, was too busy with some darn project to respond. Been rewriting from zero some custom webshop system that guys in Poland wrote ( horrible bugs, bloated and just nasty ). Ended up writing a metadata/json structure linked to a entry commit system. Yay ... 15 tables to 3, mysql queries down to 1/10 etc... Already 5 times as fast and its not even optimized. *sigh* So tired seeing entry level PHP code. Guess why i am interested in learning D. I need a break and move to something better *lol*.
 Designing a website for a company means that the marketing 
 knobs feel they have to throw in their 2 cents and want them 
 acted upon or they block the whole process - then at the end, 
 all of a sudden the boss - who never cared for the website - 
 wants to have a look too and here we go again...
 We're talking about font-sizes, gradient colors, button 2px to 
 the left, company logo bigger/smaller etc, not about the page 
 logic. Of course, because they know nothing about programming 
 they go by what they see and try to make a contribution there, 
 just for the sake of it.
No kidding ... bosses need to keep there hands out of projects. They are in general more trouble then they are worth. *lol* We just lost 2 months on a project, because the bosses had the brilliant idea to outsource and started pitching / pushing it. And the whole discussion dragged on preventing us from starting on a major project ( why start on something that may be done by somebody else? ). O, that webshop that now needs a rewrite from zero, was a direct result of another outsource. Yay! And the client ends up paying ( again ) for that. Some projects simply take time. That whole travel site was indeed slow but the end result is definitely not bad. But, like you said, sometimes too many cooks in the kitchen slows things down. My and my college have rewritten several disaster projects, mostly in 3 to 4 months time per project. The reason we are fast is because we are in sync and the bosses stayed mostly out of the rewrite projects. We do it our way ( finally ) and the end results speak for themselves. Unfortunately, bosses are bosses. Two senior PHP developers cost money ( hell, we are cheap, under payed ). They can never stop looking for money, while they trow money out of the door in one after another foolish scheme. Technically we are keeping the company afloat. *sigh*
 Unfortunately, it is often forgotten that each website needs a 
 different, unique approach. Getting inspiration from other 
 websites is good, trying to copy them is not a good idea, 
 because it will never serve your purpose optimally.
Yep ...
 The real craftsmanship behind a website is mastering the 
 various technologies that don't work smoothly together (HTML, 
 JS, PHP, forms, requests, server side stuff, browsers, data 
 bases). Web design is 90% page logic, 10% inspiration.
On this i kind of disagree. I can handle all the web techs with ease but you need people who can see things more in graphical / marketing / ease of use sense. We developers see a lot of times too much from our perspective. Its the same reason why i mentioned the whole examples on the front page. While i had more then one reason to skip D, the mentioned example was one of them. When people have choices, they make them very fast. Ali for instance, did a great job on his book. Its easy to get into, maybe a bit redundant from a more experience developers point of view but you quickly see the small details. Things you will simply look over without realizing. Stupid and simple example that will make every developer here think: "this Benjiro guy is stupid". *haha* Most example's simply show something like: writefln("The minimum of %s is %d", test, min); But what if you simply want to join two lines together. In PHP you do: print('Hello' . 'World'); Try that in D. Does not work with dot. You need to use comma's. Comma's in PHP is a instant parse error. While the dots are a compile error in D. writeln('Hello', 'World'). Yea ... sounds stupid but its those details that get lost in the flood of data. Don't overthink the whole "why do you want to merge Hello World", its just a silly example. How about ~ for merging? That is also very fast overlooked. I know it sounds ridiculous but frankly, i do not have a lot of time so i try to learn on the fly. But its annoying getting hampered by those small details when your trying some code, until you finally figure it out. Yes, its great that D has pipelines, template, alias, fibers etc but those are already more advanced concepts. Something so simple as the whole comma or merge syntax, does not even get mentioned in the Learn section ( not that i found ). I found it in Ali's book but try finding me a few D newbies that invest into buying a book or find Ali's website. It takes a while to search the website and figure even the basic resource out. And in the one spot you expect to see this, its not even mentioned. Maybe i am too much the spoilsport here but with limited amount of time, those small things quickly frustrate. Because i am already committed, i am willing to invest the limited time i have. Not all people will do that. The Learn corner is good for people with experience. But its still lacking in details. Maybe Ali can take a look at expanding it? Or maybe make Ali's book like a "newbie" learn? :) Its a bit long with 700+ pages but i do not know a single language website that has such a expanded tutorial *lol* Just my 2 cents. Its late and i am tired.
Oct 21 2016
parent Chris <wendlec tcd.ie> writes:
On Friday, 21 October 2016 at 23:08:06 UTC, Benjiro wrote:
 On Thursday, 20 October 2016 at 09:10:10 UTC, Chris wrote:
 O, that webshop that now needs a rewrite from zero, was a 
 direct result of another outsource. Yay! And the client ends up 
 paying ( again ) for that.
Some things never change...
 Unfortunately, bosses are bosses. Two senior PHP developers 
 cost money ( hell, we are cheap, under payed ). They can never 
 stop looking for money, while they trow money out of the door 
 in one after another foolish scheme. Technically we are keeping 
 the company afloat. *sigh*
Some things never change...:)
 The real craftsmanship behind a website is mastering the 
 various technologies that don't work smoothly together (HTML, 
 JS, PHP, forms, requests, server side stuff, browsers, data 
 bases). Web design is 90% page logic, 10% inspiration.
On this i kind of disagree. I can handle all the web techs with ease but you need people who can see things more in graphical / marketing / ease of use sense. We developers see a lot of times too much from our perspective.
I meant that the design can be fixed fast after having been tested by users. It's not rocket science. A lot of it is common sense, but design is what everybody sees, so it makes a bigger impression on the marketing section. They don't care for the lean data base design you might be proud of, they want a shiney button that says "Book now" :)
 Its the same reason why i mentioned the whole examples on the 
 front page. While i had more then one reason to skip D, the 
 mentioned example was one of them. When people have choices, 
 they make them very fast.

 Ali for instance, did a great job on his book. Its easy to get 
 into, maybe a bit redundant from a more experience developers 
 point of view but you quickly see the small details. Things you 
 will simply look over without realizing.

 Stupid and simple example that will make every developer here 
 think: "this Benjiro guy is stupid". *haha*
The thing is that it takes time to learn a language like D and get used to its idioms. And as has been pointed out, different newbies have different expectations. What you could do for D, if you wish, you could draw up a syntax cheat sheet with one-line examples. 1. String concatenation `~` // writeln("Hello, " ~ "world!"); 2. Array concatenation ... 3. Assoc array syntax ... etc. I sometimes too get stuck on little things like that when I have to work with a language I'm not familiar with ("." or "+" or ...) Don't ask what D can do for you, but what you can do for D. I ripped that one :)
Oct 22 2016
prev sibling parent reply Chris <wendlec tcd.ie> writes:
On Tuesday, 18 October 2016 at 20:51:24 UTC, Karabuta wrote:
 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.
How do you know "they" will not understand? Maybe they do.
 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.
At the beginning, D was not meant to be a "first language", but this has changed over time. In fact, almost all new modern languages that emerge now have features that D has, like templates, !boo ;), so beginners will have to learn them regardless of what new language they pick. Thus, D is no longer "worse" or "more complicated".
 How do you win a visitor's interest in 2-5 seconds?
Put a scantily dressed lady on your page ;) Seriously, there will always be those who will prefer shiny buttons and fancy talk to facts or usability.
Oct 19 2016
parent reply Benjiro <benjiro benjiro.com> writes:
On Wednesday, 19 October 2016 at 09:32:29 UTC, Chris wrote:
 At the beginning, D was not meant to be a "first language", but 
 this has changed over time. In fact, almost all new modern 
 languages that emerge now have features that D has, like 
 templates, !boo ;), so beginners will have to learn them 
 regardless of what new language they pick. Thus, D is no longer 
 "worse" or "more complicated".

 How do you win a visitor's interest in 2-5 seconds?
Put a scantily dressed lady on your page ;)
Yep ... instant 1000+ visitors, just the wrong kind. Now, if it was a programming challenge and and you can code to undress. Now that will draw in the right kind. *haha*
 Seriously, there will always be those who will prefer shiny 
 buttons and fancy talk to facts or usability.
Its that what is actually the issue. The fact that some think people want fancy buttons. And no offense but basic D is just the same as basic PHP. They are all C languages. If somebody can start in PHP, they can start in D. The big difference is that there is much more materials available for PHP, so people more easily start. It also helps that you do not need to do a lot of setting things up for PHP ( web hosts ready ). Where as with D, you need to download the compiler, have a root server etc ( if your looking at web programming ). If you give a novice a D basic hello world or a PHP basic hello world, they can get going with both at the same level. Same with some high level ( basic logic if/else, loops, etc ). That is all the same or so simulare. But when you trow people into the deep end with pipeline one-liners, templates, mapping etc... sorry but that is way above a lot of people there first experience with a language. You have 3 class of people: * Total newbies: People who want to see something simple. If i do x, then i get y. Ooooo, shiny. *lol* * People with some experience in other languages: They look for similarities, they try to match there logic to the new language. This is actually a big group of potential recruits. A lot of those are actually self-taught programmers. * People with large experience: They are advanced programmers. Linking advanced features from one language to another is no issue. They can quickly tell from the summary what the real advantages of a language are. All the programming lingo is no issue for them. The current homepage example is in my option, right between group 2 and 3. And its disregarding group one and two.
Oct 19 2016
next sibling parent Chris <wendlec tcd.ie> writes:
On Wednesday, 19 October 2016 at 09:51:50 UTC, Benjiro wrote:
[snip]

 And no offense but basic D is just the same as basic PHP. They 
 are all C languages. If somebody can start in PHP, they can 
 start in D. The big difference is that there is much more 
 materials available for PHP, so people more easily start.

 It also helps that you do not need to do a lot of setting 
 things up for PHP ( web hosts ready ). Where as with D, you 
 need to download the compiler, have a root server etc ( if your 
 looking at web programming ).

 If you give a novice a D basic hello world or a PHP basic hello 
 world, they can get going with both at the same level. Same 
 with some high level ( basic logic if/else, loops, etc ). That 
 is all the same or so simulare.

 But when you trow people into the deep end with pipeline 
 one-liners, templates, mapping etc... sorry but that is way 
 above a lot of people there first experience with a language.
While very basic D is indeed like C, the truth is that you'll soon get stuck, if you know nothing about templates.
 You have 3 class of people:

 * Total newbies: People who want to see something simple. If i 
 do x, then i get y. Ooooo, shiny. *lol*
They're welcome. But without hard work, they won't get far in any language.
 * People with some experience in other languages: They look for 
 similarities, they try to match there logic to the new 
 language. This is actually a big group of potential recruits. A 
 lot of those are actually self-taught programmers.
I agree. But again, without templates and ranges, they won't get far. The danger is that you wouldn't want to teach them D the wrong way, only for them to find out later that "that's not how you do it". Better tell them from the start. Introduce on concept at a time.
 * People with large experience: They are advanced programmers. 
 Linking advanced features from one language to another is no 
 issue. They can quickly tell from the summary what the real 
 advantages of a language are. All the programming lingo is no 
 issue for them.

 The current homepage example is in my option, right between 
 group 2 and 3. And its disregarding group one and two.
Sure there's nothing wrong with adding one or two "simpler" examples. But it shouldn't be just plain C. Have you had a look at this page: https://p0nce.github.io/d-idioms/ Maybe you can find something you like and think it'd be a good example.
Oct 19 2016
prev sibling parent Chris <wendlec tcd.ie> writes:
On Wednesday, 19 October 2016 at 09:51:50 UTC, Benjiro wrote:
 The current homepage example is in my option, right between 
 group 2 and 3. And its disregarding group one and two.
What about setting up snippets about things people want to know about straight away like: 1. OOP 2. Functional programming 3. Multi-threading and then go into more specific stuff 4. Ranges [...] What did you want to know about as a newbie? I suppose server related stuff, which is vibe.d.
Oct 20 2016