"with" still sucks + removing features + adding features

bearophile bearophileHUGS at lycos.com
Mon May 18 12:18:59 PDT 2009


Andrei Alexandrescu:

Thank you for your answers.

>To be brutally honest, I think many features discussed here are completely missing the point.<

I know, most of the things I say are wrong or useless. I am not good at all. Yet, no one is perfect, and in the past I/we have discussed about several things that are badly designed in D.


>Only a couple of posts ago, there were suggestions for alternate syntaxes for "with" that were not only useless, they added new keywords like they were up for grabs. If somebody wants to make "as" into a keyword, I'm liable to go postal.<

That was me, and it was not a much serious proposal (I was not sure in the first place).
But sometimes I don't like how much D relies on punctuation (like the semicolon in the middle of foreach).
When I see a syntax like:
alias foo bar;
I often have troubles understanding if the new name is bar or foo.
A syntax like:
alias foo as bar;
Is less ambigous.
Now feel free to go postal :-)

I have even troubles to remember if in the following syntax n is the number of rows or the number of columns:
auto mat = new[][](n, m);
Maybe I'm just dumb :-)


>My perception is that the recently-added features are of good quality.<

This is probably thank to you too, because now there are two people designing things instead of just one.


> It looks and is a million times worse. If you know D1 and see
> case 'a': .. case 'z':
> you pretty sure know exactly what's going on. If you know D1 but haven't
been illuminated by the likes of Ruby and Chapel and see:
> case 'a' .. #'z':
> you're like, what the heck were they thinking about when they designed this ass-backward syntax?

The problem with a syntax like:
case 'a': .. case 'z':
Is that it's not general enough. The language clearly needs a syntax to specify ranges, both closed and open, that can iterated on, that support opIn_r, that can lazily iterated, that have a length, etc. Using a .. syntax inside the foreach, and another .. syntax inside the switch, and defining iota() into the std lib, doesn't like a good idea to me. It howls for a general language-wide solution.

Bye,
bearophile



More information about the Digitalmars-d mailing list