News for hackers. Stuff that matters.
Re:Juno: A Lightweight and Simple Web Framework for Python by hesdeadjim on Wednesday May 13, 2009 @01:07AM (#606553)
While I respect the cleverness of his hack, it's the kind of thing that sets off alarm bells in my head. Much like fancy template metaprogramming tricks in C++ did, only worse since it actually breaks the semantic contract that the language imposes for comment blocks.
Re:Juno: A Lightweight and Simple Web Framework for Python by jawngee on Wednesday May 13, 2009 @03:48AM (#606623)
You're way over thinking the problem.

I'm not so sure there is a "semantic contract" for comment blocks since they're made available via reflection. Comments are metadata after all.

And this is more akin to annotations/attributes ala python, java, C#. C++ doesn't have any feature that is approximate by virtue that annotations are aspects of reflection and C++ doesn't have reflection.

Re:Juno: A Lightweight and Simple Web Framework for Python by cnlwsu on Wednesday May 13, 2009 @06:55AM (#606722)
I dont know if I would call a comment(part of language that has meaning only to the programmers) equivalent to a language defined thing like annotations/attributes which has specific meaning to the compiler/interpreter. But I do aggree it CAN be metadata in the same regard a file name or path can be (which many frameworks use).
Re:Juno: A Lightweight and Simple Web Framework for Python by jrockway on Wednesday May 13, 2009 @07:38AM (#606745)
Using docstrings as executable code is an indication that your language lacks actual extensibility.
Re:Juno: A Lightweight and Simple Web Framework for Python by KrisJordan on Wednesday May 13, 2009 @10:24AM (#606924)
They're not used as executable code. They're used as meta data. Not much different than an XML file sitting beside of a script, except that

1) it's more DRY because for external files to say something about a construct in code there is repeated information, i.e. <route><to><class>Foo</class><method>bar</method></to><from><method>GET</method><url>some/url/here</url></to></route>,

2) because you're using the PHP language to specify metadata about a PHP construct refactoring is easier, i.e. change the name of a function and you don't have to go update your routing somewhere else,

3) having the metadata inline with code turns out to be mentally lightweight once you get over the initial shock of seeing metadata in a comment.

Re:Juno: A Lightweight and Simple Web Framework for Python by randallsquared on Wednesday May 13, 2009 @09:06AM (#606814)
However, for PHP, we really didn't need the indication. :) I use PHP every day, though, and it gets the job done.