On Sat, Dec 7, 2013 at 2:17 PM, Peter Ahé <
a...@google.com> wrote:
> The reason why I suggested a colon is that it looks like a parser
> error from the VM. However, I meant semicolon :-)
>
Sorry for the delay in responding. And I did read your sentence as
semicolon...didn't even notice the discrepancy. But yes, I had one in
place.
It turns out that I was facing two errors with implementing logging,
both rather subtle to a Dart newcomer. See below.
> It still looks like a parser error, so I'd really like to know what
> the previous four lines looked like. So I can rule out if this is a
> parser bug, or a case where we could produce a better error message.
OK, I went back and re-created the test app I was playing around with
to try and figure out what was going wrong. And the previous four
lines were simply:
import altapp;
import 'package:logging/logging.dart';
But the problem was that I was then using the Logger keyword outside
of the main function scope. This restriction is mentioned nowhere in
the logging package documentation (that I could find, at least), but I
read in Chris Buckett's blog post I referenced above that the Logger
class must be initialized inside the main function scope. So that was
one of my two problems.
The other problem I was running into was that the Express library I
was using had implemented its own extensible Logger class that was
conflicting with my attempts at initializing my own. Once I went back
and changed Express's logging to the library logging recommended in
the blog post, it worked fine with my app's logging. I could have
probably also used Express's extensible logging, but I decided I
preferred to use Chris's approach (the beauty of open source!).
By the way, I'm really impressed by both the language *and* by
Dartist's Express framework. There's not a lot of documentation on
most Dart libraries at this point, but once I went and read Express's
source code, it became clear that it could be easily extended to do
everything I was looking for (e.g., authentication middleware). I'll
try to write up my own blog post outlining what I've done to help
future Dart users implement server-side apps.
My 2-day impression of Dart is that it's a solid and easy-to-use yet
powerful and safe alternative to JavaScript. My only hesitation in
recommending Dart at the present time would be the relative immaturity
of and the lack of documentation to important third-party libraries
(Dart itself is remarkably well-documented for such a new language).
But I know these things will just take time to develop, and that the
language has only in recent months reached the point of stasis needed
to create solid, dependable third-party packages.
Thank you both for your input.
Eric