Another Phobos2 test

Adam D. Ruppe destructionator at gmail.com
Tue Feb 8 17:17:42 PST 2011


bearophile:
> I see. I prefer to see a chunk of code that does something, on the > screen, and
to not scroll too much.

That's what functions are for!

> I meant something different. I don't want to convert JSON tree
> from-to text, I'd like to bypass the text representation fully.

Yes, that would be the ideal implementation. But as a practical
matter, who's going to write that code? I don't know the compiler
well enough to do it myself, but I am confident that I could
write a little program to call and parse dmd -X; it's something
we could do ourselves without bugging Walter.

We need to look more at imperfect solutions we can do ourselves
with the existing tools than the perfect solutions that need
smart people like Walter and Don to do for us.

> It matters if you want to use the JSON data in a larghish program
> as a static reflection mean to implement good user defined
> attributes. The less you convert and parse data, the faster and
> more usable the whole game is.

If the build tool was sufficiently smart (something as simple
as plain old make is good enough for this), it could only parse
the json once.

Again not ideal, but something simple we could do ourselves.


On user defined attributes, I wish the @attrs were done differently,
but what's done is done and I don't know the compiler well enough
to write a patch.

Instead, we might look at some template ideas that define some
enums we can use to access the attributes. As I understand it,
Ruby does something similar to this too.

> I don't remember Andrei's opinion about that idea.

It's been discussed on the Phobos list pretty recently. Look
for the threads about new string types (I don't remember the
exact subject, but Steven did a lot of work on it so searching
for his name with the string keyword should find the thread.)

> If you start putting parentheses everywhere, you produce
> something less readable than Lisp.

Gah, that Haskell already is significantly less readable to Lisp!

Actually, on optional parens in D, I'm almost split on that. I
resisted dropping them from templates at first, but now I love
it. I like the property syntax just the way it is too (well,
usually. It's annoying when it calls the function when I don't
want it to though!)


More information about the Digitalmars-d mailing list