Raku / raku.org

Source code for https://raku.org/
https://raku.org/
Artistic License 2.0
70 stars 50 forks source link

Simpler example is needed #98

Closed AlexDaniel closed 1 year ago

AlexDaniel commented 6 years ago

This ticket was motivated by this issue: https://github.com/perl6/marketing/issues/9#issuecomment-375389577

Go to https://perl6.org/ and you will be welcomed with this example:


grammar Parser {
    rule  TOP  { I <love> <lang> }
    token love { '♥' | love }
    token lang { < Perl Rust Go Python Ruby > }
}

say Parser.parse: 'I ♥ Perl';
# OUTPUT: 「I ♥ Perl」 love => 「♥」 lang => 「Perl」

say Parser.parse: 'I love Rust';
# OUTPUT: 「I love Rust」 love => 「love」 lang => 「Rust」

It's not too complicated, I agree. But don't we want to show something simpler first? For example, this is the third example:

# No floating point noise:
say 0.1 + 0.2 == 0.3;        # OUTPUT: True
say (1/13 + 3/7 + 3/8).perl; # OUTPUT:  <641/728>

And IMO it is much more straightforward.

Maybe we can just rearrange them to get the desired effect, but IMO we should show some real basics first (variables, for loop, etc.).

zoffixznet commented 6 years ago

(variables, for loop, etc.).

In other words, stuff that all languages have and no one cares about?

The homepage examples should show off our flagship features: I'd definitely put Grammars & Unicode support on first place and Ease of Async/Concurrency/Parallelism on second, and I see the examples are currently arranged to show just that.

And IMO it is much more straightforward.

It's also a lot more boring, shows a feature that's available in all languages—either by default or via libraries—and requires non-trivial CS knowledge about floating point math and its issues to fully appreciate its significance.


I think this proposal conflates teaching the language with showing off cool features of the language. The reader isn't meant to understand all of the code—just the input, resultant output, and the approximate amount and structure of the code involved to produce the behaviour.

AlexDaniel commented 6 years ago

Maybe you're right.

coke commented 1 year ago

I think @zoffixznet is right, closing ticket.