New article: Dart Puzzlers #2

29 views
Skip to first unread message

Kathy

unread,
Feb 29, 2012, 8:32:16 PM2/29/12
to General Dart Discussion
As promised during today's hangout, we've published Joshua Bloch's
latest Dart puzzler article:

http://www.dartlang.org/articles/puzzlers/chapter-2.html

This one's all about strings, characters, and other textual data. The
upshot: 9 of the 13 puzzles are "clear wins for Dart". Just one puzzle
is as bad in Dart as it was in Java.

See the article for all the details. And if you haven't seen the first
puzzler article, you can find it (and, soon, more articles) at
http://www.dartlang.org/articles/puzzlers/.

-k-

gabriele renzi

unread,
Mar 1, 2012, 4:02:24 AM3/1/12
to General Dart Discussion
Hi,

please excuse these question from a newbie, but what does the text in
#13 mean?

""" Happily, we’re hard at work eliminating the string concatenation
operator from Dart """

Does this mean that String#+ will disappear?

It seems to me that a better solution would be to have the operator
work in dart as it does in ruby/python and fail when the argument is
not a string(-ish) object.
This also seems to fit within the optional type framework and static
analysis tooling.


Ladislav Thon

unread,
Mar 1, 2012, 4:52:30 AM3/1/12
to General Dart Discussion
Two haven't been fixed, but aren't really worth fixing either (19 and 22).
 
Ad 19: come on... let's get rid of multi-line comments at all. They aren't needed for anything, like this puzzler says. We already have /// for documentation comments, so why bother?

LT

Ladislav Thon

unread,
Mar 1, 2012, 4:57:39 AM3/1/12
to General Dart Discussion
Oh, and as Josh asked for feedback in the hangout (and wrt puzzler 23): I'm all in for eliminating the "visual fallthrough" in the switch statement, at the syntax level. Having

switch (foo) {
  case 1: { ... }
  case 2: { ... }
}

and getting rid of break is great (although I rarely use the switch statement at all).

LT

Sam McCall

unread,
Mar 1, 2012, 5:02:47 AM3/1/12
to Ladislav Thon, General Dart Discussion
I was about to call you crazy, but realised that my multiline comments are all either:
/*
 * 
 * 
 */
(where I mark every line anyway) or:
/*
  dead code
 */
which is a bad habit...

Down with multiline comments!

Daniel James

unread,
Mar 1, 2012, 6:07:45 AM3/1/12
to Kathy, General Dart Discussion
On 1 March 2012 01:32, Kathy <kat...@google.com> wrote:
> As promised during today's hangout, we've published Joshua Bloch's
> latest Dart puzzler article:
>
> http://www.dartlang.org/articles/puzzlers/chapter-2.html

I think I noticed a couple of small errors. In puzzle 14 the java
example is in dart, which confuses the character counts. In puzzle 19
it says, "The alternative, which is to have multi-line comments nest,
is no better". They do actually nest, the issue is that they ignore
quotes (sorry if that's a bit pedantic, but it could be misleading).

Reply all
Reply to author
Forward
0 new messages