08-Apr-2013 19:17, Andrei Alexandrescu пишет:
On 4/8/13 3:35 AM, Jacob Carlborg wrote:
Scott Meyers had a talk about what he called red code/green code. It was
supposed to statically enforce that green code cannot call red code.
Then what is green code is completely up to you, if it's memory safe,
thread safe, GC free or similar.
I don't remember the conclusion and what could be implemented like this,
but here's the talk:
http://www.google.com/url?sa=t&rct=j&q=scott%20meyers%20red%20green%20code&source=web&cd=1&cad=rja&ved=0CCsQtwIwAA&url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DJfu9Kc1D-gQ&ei=fXJiUfC3FuSB4gS41IHADQ&usg=AFQjCNGtKwLcr2jNjsC4RJ0_5k8WmAFzTw&bvm=bv.44770516,d.bGE
Article: http://www.artima.com/cppsource/codefeaturesP.html
It's one of Scott's better works but it went underappreciated. I think
it would be worthwhile looking into how to implement such with D's
features (notably attributes).
I guess that the implementation far behind the beauty of concept.
IRC I once proposed something to the same affect of the red/green code.
I was trying to see what kind of general feature could supersede
@safe/@trusted/@system, pure and nothrow. The end result of that
exercise for me was that there is exactly 2 orthogonal features:
- tags on code with policies that manage the relation of these
(much like routing policy)
- a tool to define restrict blocks of code to a certain subset of
language(here goes nothrow, nogc, pure - various sets of restrictions)
The problem is picking cool syntax, implementation :o) and doing some
crazy field testing.
Andrei
--
Dmitry Olshansky