Steve Yegge's rant on The Next Big Language

BCS ao at pathlink.com
Mon Feb 12 22:59:16 PST 2007


Reply to Jarrett,

> "BCS" <BCS at pathlink.com> wrote in message
> news:eqq7nq$2tut$1 at digitalmars.com...
> 
>> Half?, more like one or two hard misses and a few more close calls.
>> 
> Well let's see:
> 
> 1. Object-literal syntax for arrays and hashes
> 
> Arrays?  Yes.  Hashes?  no.
> 

Hashes can be done +(1 + .5)/2

> 2. Array slicing and other intelligent collection operators
> 
> Yes.

+1

> 
> 3. Perl 5 compatible regular expression literals
> 
> No.  It did in a way at one point, but no one liked that.
> 

Regex is there but not as a native type. IIRC however these is a project 
to do compile time regex compilation.

+.5

> 4. Destructuring bind (e.g. x, y = returnTwoValues())
> 
> No.

Not as part of the language but, again it can be done:

Slightly better syntax than before:

struct SetT(V...)
{
  V args_m;
  void opCall(inout V args)
  {
    foreach (i, arg; args_m) args[i] = arg;
  }
}

SetT!(V) Set(V...)(V args)
{
  SetT!(V) ret;
  foreach (i, arg; args) ret.args_m[i] = arg; 
  return ret;
}

SetT!(int,int) bar(int i, int j){ return Set(i,j); }

void main()
{
  int i=1,j=2,k=0,l=0;
  bar(i,j)(k,l);
  writef("[k,l]=[%d,%d]\n", k,l);
}

+.5

> 
> 5. Function literals and first-class, non-broken closures
> 
> Function literals, yes; non-broken closures, no.  How many posts have
> we had in the past month that had to do with people returning nested
> functions?  :S
> 

that's broken usage, not a broken feature, they work if you do them right, 
just as pointers do.

+1

> 6. Standard OOP with classes, instances, interfaces, polymorphism,
> etc.
> 
> Yes.
> 

+1

> 7. Visibility quantifiers (public/private/protected)
> 
> Yes.
>

+1
 
> 8. Iterators and generators
> 
> Not in the way I think he means.  There's opApply, but..
> 

foreach will take delegate, and with only a little work the delegate can 
carry context from one foreach to the next

auto it = WalkList("hello world");

foreach(char c; it)
  if(c == ' ')
    break;
  else
    writef(c);

writef(\n);

foreach(char c; it)
  writef(c);

other options include:

Nested iteration

foreach(rec; DB.WithName("bob").ageOver(65).Male.iter)

Joined iteration of AA's

int[char[]] foo, bar;
foreach(char[] k, int v; Inter(foo, bar))

I could be wrong but I don't see what that doesn't cover.

+1

> 9. List comprehensions
> 
> No.

Ok, I'll bite, What is it?

+??

> 
> 10. Namespaces and packages
> 
> Package namespaces... yes.  ;)
> 

+1

> 11. Cross-platform GUI
> 
> No!
> 

Hard miss.

+0

> 12. Operator overloading
> 
> Yes.

+1

> 
> 13. Keyword and rest parameters
> 
> No, but what does he mean by "rest"?  Vararg?  That's a yes, but..
> 

I'm not sure what this is
+??


> 14. First-class parser and AST support
> 
> If he means "code modifying other code" then no, certainly not
> first-class.
> 

Hard miss. Unless you count mixin or template code

+0

> 15. Static typing and duck typing
> 
> Yes.  (Unless some duck typing expert wants to correct me, I _think_ D
> has it)

+1

> 
> 16. Type expressions and statically checkable semantics
> 
> I won't lie, I don't know what this means.  But it doesn't sound like
> D has them since I've never heard of them.
> 

I'd count template's that construct types under this, as well as the ability 
to statically check operator restrictions

somewhere Oskar Linde has a Unit checking template that at compile time checks 
for errors like adding meters to Newtons

+1

> 17. Solid string and collection libraries
> 
> _Libraries_?  Noooo.
> 

We don't need them, D's AA's and dynamic arrays cover most of it and IIRC 
there are about a dozen libs for playing with them when you need more, clean 
them up a little and you've got it.

+1

> 18. Strings and streams act like collections
> 
> Yes, if by "collection" you mean "you can iterate over them."
> 

+1

> So counting the ones that are partially yes as 0.5, and the yeses as
> 1.0, I get 9.  9/18 = 0.5
> 

I get 12.75 of 18 with only 2 hard misses and two that I don't known what 
they are.

However that's just my counting, based on my assumptions:

breakable features count [see #5] (everything is breakable if you try hard 
enough)
available with libs gets part credit [#1, 3, 4]
a feature is as good as a lib [#17]





More information about the Digitalmars-d-announce mailing list