July 13, 2013
On 07/12/2013 10:34 PM, QAston wrote:> On Saturday, 13 July 2013 at 04:42:58 UTC, QAston wrote:
>> Also, i don't know what's wrong with parens - 2 additional keystrokes?
>> I didn't see a for loop i a long time - ranges + foreach are
>> everywhere. And foreach is 4 chars more to type than for :P.
>
> Replying to myself, but well, this is flawed, foreach is ususally
> shorter than for.

Especially when for loops can be infinitely long. :) I think the actual syntax of 'for' may be surprising to most:

  http://dlang.org/statement.html#ForStatement

import std.stdio;

void main()
{
    for ( {
            int i = 0;
            double d = 0.5;

            struct S
            {
                string s;
            }

            auto s = S("hello");

            writeln("I am in the initialization clause of a for loop!");
        } i < 10; ++i) {

        writeln("i: ", i, ", d: ", d);
        d /= s.s.length;
    }
}

Ali

July 13, 2013
On Saturday, 13 July 2013 at 06:56:46 UTC, Ali Çehreli wrote:
> On 07/12/2013 10:34 PM, QAston wrote:> On Saturday, 13 July 2013 at 04:42:58 UTC, QAston wrote:
> >> Also, i don't know what's wrong with parens - 2 additional
> keystrokes?
> >> I didn't see a for loop i a long time - ranges + foreach are
> >> everywhere. And foreach is 4 chars more to type than for :P.
> >
> > Replying to myself, but well, this is flawed, foreach is
> ususally
> > shorter than for.
>
> Especially when for loops can be infinitely long. :) I think the actual syntax of 'for' may be surprising to most:
>
>   http://dlang.org/statement.html#ForStatement
>
> import std.stdio;
>
> void main()
> {
>     for ( {
>             int i = 0;
>             double d = 0.5;
>
>             struct S
>             {
>                 string s;
>             }
>
>             auto s = S("hello");
>
>             writeln("I am in the initialization clause of a for loop!");
>         } i < 10; ++i) {
>
>         writeln("i: ", i, ", d: ", d);
>         d /= s.s.length;
>     }
> }
>
> Ali

I love this feature so much ^^
July 13, 2013
> I think that Python has syntax evidently and demonstrably superior to D. Why not Python?

White spaces with meaning cause hard to find bugs, the Python syntax is not appropriate for large projects and this is well known. That is not the case for the small changes Go has made.
July 13, 2013
ixid:

> White spaces with meaning cause hard to find bugs, the Python syntax is not appropriate for large projects and this is well known.

Well known by who? What's your evidence? My experience says otherwise :-)

Bye,
bearophile
July 13, 2013
On Saturday, 13 July 2013 at 01:06:09 UTC, H. S. Teoh wrote:
> On Fri, Jul 12, 2013 at 05:51:21PM -0700, Brad Roberts wrote:
>> On 7/12/13 1:46 PM, ixid wrote:
> [...]
>> >It seems a pity that D is achieving such power and elegance in some
>> >areas while failing to take on some of the syntactic beauty that is
>> >within reach. The ultimate language would look something like D
>> >crossed with Go in my eyes. It would be interesting if someone were
>> >able to make a D subset that showed what it could look like. There is
>> >significant value to being easy to read and write, making the
>> >language naturally more appealing for users just as speed makes
>> >applications much more attractive to users.
>> 
>> One person's beauty is another person's ugly.  This is an area that
>> reasonable people are going to disagree on.  You're feeling on their
>> reasons is rather dismissive.
>
> I find this fixation on syntax rather strange. As long as the syntax is
> not *too* ugly (*cough*C++ templates*cough*) isn't the *semantics* more
> important? A pretty language that has limited expressiveness is useless;
> a powerful language that's a bit ugly in syntax isn't any less powerful
> because of it.
>

Of course, .net demonstrates this very well... but do you really expect most people to really be able to think that abstractly? Syntax is meaningless but necessary... see http://en.wikipedia.org/wiki/Malbolge.
July 13, 2013
On Sat, 2013-07-13 at 12:43 +0200, ixid wrote:
> > I think that Python has syntax evidently and demonstrably superior to D. Why not Python?
> 
> White spaces with meaning cause hard to find bugs, the Python syntax is not appropriate for large projects and this is well known. That is not the case for the small changes Go has made.

Who says Python is not appropriate for large projects? What is their authority for saying this?

This claim is certainly not well known, nor is it understood or believed by anyone undertaking serious software projects that involve Python.

Some of the enforced syntactic constraints of Go due to the deduced semi-colon insertion, are awful and ugly, in my opinion. To hide the issues by trying to make a benefit from there being "one and only one allowable style of Go code" enforced by gofmt is actually running away from the real problem.

Personally I think parentheses enclosing the control expressions in for statements and end of statement semi-colons are anachronisms. C++ and D choose to keep them, which is irritating. Go always has end of statement semi-colons even if the source code appears not to.
-- 
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


July 13, 2013
On Sat, Jul 13, 2013 at 05:08:11PM +0200, JS wrote:
> On Saturday, 13 July 2013 at 01:06:09 UTC, H. S. Teoh wrote:
[...]
> >I find this fixation on syntax rather strange. As long as the syntax is not *too* ugly (*cough*C++ templates*cough*) isn't the *semantics* more important? A pretty language that has limited expressiveness is useless; a powerful language that's a bit ugly in syntax isn't any less powerful because of it.
> >
> 
> Of course, .net demonstrates this very well... but do you really expect most people to really be able to think that abstractly? Syntax is meaningless but necessary... see http://en.wikipedia.org/wiki/Malbolge.

That's not a fair example. I *did* say, as long as the syntax is not *too* ugly. Malbolge doesn't qualify. :)  I mean, if you really want to push this to the extreme, you could say we should all just write lambda expressions, since it's all Turing-complete anyway.

The difference between D and Malbolge is on a totally different scale than the difference between for(...){...} and for ...{...}. Just because the difference between walking to a destination vs. driving there is a big difference, doesn't mean that the difference between whether you wear a red shirt vs. a white shirt while travelling is an important issue.


T

-- 
Windows 95 was a joke, and Windows 98 was the punchline.
1 2 3
Next ›   Last »