Arc Forumnew | comments | leaders | submitlogin
Questions about hacking server/app arc code
1 point by thaddeus 5933 days ago | 2 comments
So the other night I set out to change the arc 'inputs' function as so the text-areas would appear on a new line after the 'title'. Initially this looked pretty easy requiring only the I take out the table tags and add breaks. However I struggled for a few reasons:

1. I'm still learning how 'map' fn works so it's all a little fuzzy to me. :) Even though I got the inputs function to output the correct tags, it for whatever dies on "u" (not finding the arg).

2. The bigger issue ... every time I tried to re-load the function, as I hacked it, the changes wouldn't 'take'. It's like they were ignored until I relaunched the arc environment..(and it's not because I didn't change a dependency ...(defopl name)->(log-in switch)->(pwfields args)->(inputs args))

So the question I am hoping someone can answer is.... is there some 'binding' at such a low level that function re-defines wouldn't take ? Is it a case of how the server code loads into memory ? is the server code protected in memory while running ? Some times, other times, I noticed when (sequentially) I loaded a function would determine if it 'takes' even when no such dependency appears in the code.....

Just curious. Thanks, T



3 points by CatDancer 5933 days ago | link

"inputs" is actually a macro, so changing "inputs" will only affect code that you load after the change. (A macro works by transforming the code it is applied to, so after the code has been transformed the macro isn't used anymore).

For your first question, can you post your definition that isn't working for you?

-----

2 points by thaddeus 5933 days ago | link

I see - I didn't know macs transformed code like that.... I just reversed the order of loading my mac's and tada - everything worked!

Thanks! T.

the hack i did turned out to work, but as requested, here it is:

    (mac x-inputs args
      `(tag (table border 0)
         ,@(map (fn ((name label len text))
                  (w/uniq (gl gt)
                    `(let ,gl ,len
                           (pr ',label ":")
                           (if (isa ,gl 'cons)
                               (do (textarea ',name (car ,gl) (cadr ,gl)
                                     (let ,gt ,text (if ,gt (pr ,gt)))(br)))
                               (do (br)(gentag input type  ',(if (is label 'password) 
                                                            'password 
                                                    'text)
                                         name ',name 
                                         size ,len 
                                         value ,text)    (br))))))
   (tuples args 4)))
)

-----