Hello, I created the following function which is supposed to execute when a source on_connect is triggered: register_source=fun (headers)-> begin data=snd(fst(http.post(data="action=source_add",headers=headers,"http://something_which_returns_title_and_artist_headers"))) artist=list.assoc("artist",data) title=list.assoc("title",data) rewrite_metadata([("artist",artist),("title",title)],src) end However, the register_source function is supposed to be called by the on_connect parameter of the src source, and is supposed to call the src source itself as well in a rewrite_metadata function. SO, either the source or the function fails because of a variable not previously defined. I thought about making the register_source function a reference. for example: register_source=ref fun ()->() src = input.harbor(...,on_connect=!register_source()) register_source:=see function above I however don't know how to create the reference variable itself. I get this kind of errors: At line 44, char 16-17: this value has type ref((...)->unit) (infered at line 31 char 17 - line 36 char 3) but it should be a subtype of (the type of the value at line 44 char 16 - line 50 char 3) ref((...)->source(_))
So my question is, how to accomplish my goal so both the source and the function can access eachother? is it possible in an on_connect function to reference to its container source? Thanks in advance, Leonard ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_mar _______________________________________________ Savonet-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/savonet-users
