Arc Forumnew | comments | leaders | submit | forgotmypass2's commentslogin

In Python + Werkzeug:

    def said(request):
        if "msg" in request.cookies:
            resp = BaseResponse('<html><body><h1>You said:</h1><p>%s</p></body></html>' % request.cookies['msg'], mimetype='text/html')
        elif request.method == 'POST':
            resp = BaseResponse('<html><body>Click <a href="/arctest">here</a>.</body></html>', mimetype='text/html')
            resp.set_cookie("msg", value=request.form.get("msg"))
            resp = BaseResponse('<html><body><form action="/arctest" method="post"><input type="text" name="msg" /></form></body></html>', mimetype='text/html')
        return resp
Even a newbie that's never seen Python or Werkzeug could make sense of it. I don't think you can say the same of the Arc code, it looks like magic.


4 points by kennytilton 5952 days ago | link

Well, yes, that is the beauty of macros. What is holding you back from the Arc example is that it makes you nervous -- how can it work?! I do not see all the moving parts! But then when we are programming heads down do we really want to see all the plumbing? Macrology is all about hiding the boilerplate so we are looking at just what matters. But yes again: make sure your macros (or the ones in the library you choose to adopt) work. :) Once you have satisfied yourself of that, as a developer you are in a much better place. My 2, anywho.


2 points by pg 5952 days ago | link

I think it depends on what you're used to. The Arc version seems a lot more comprehensible to me.


1 point by user8472 5943 days ago | link

Actually, I agree with this one. For me, personally, the Arc solution is more readable. It depends on what one is used to.

The question is what the majority of other people think (since that's what really matters).


3 points by t1m 5951 days ago | link

"Any sufficiently advanced technology is indistinguishable from magic."