It took me a few hours of research and trial and error but I think this will work:
user=> (def foo-handler (reify System.Web.IHttpHandler (get_IsReusable [this] false) (ProcessRequest [this context] ()))) #'user/foo-handler user=> On Mon, Dec 9, 2013 at 12:38 PM, Frank Hale <[email protected]> wrote: > I also tried deftype > > (deftype foo-handler [] > System.Web.IHttpHandler > (get_IsReusable [this] false) > (ProcessRequest [this context] ())) > > InvalidCastException Unable to cast object of type 'clojure.lang.Var' to > type 'System.Type'. clojure.lang.Namespace.ReferenceClass > > > On Mon, Dec 9, 2013 at 12:24 PM, Frank Hale <[email protected]> wrote: > >> Hi John, >> >> Yes I've tried adding get_ to the property name but I'm still not doing >> something correctly. >> >> (defn foo-handler [] >> (reify System.Web.IHttpHandler >> (get_IsReusable [] false) >> (ProcessRequest [context] ()))) >> >> CompilerException clojure.lang.CljCompiler.Ast.ParseException: Must >> supply at least one argument for 'this' in: get_IsReusable >> >> If I supply 'this' in the arg list for get_IsReusable I get another error >> (which is correct because get_IsReusable is a zero arg function): >> >> CompilerException clojure.lang.CljCompiler.Ast.ParseException: Can't >> define method not in interfaces: get_IsReusable >> >> >> >> >> >> On Mon, Dec 9, 2013 at 12:15 PM, John D. Hume >> <[email protected]>wrote: >> >>> If I recall, properties are just syntactic sugar for awkwardly named >>> methods. Have you tried the compiler-generated get and set method-names? >>> On Dec 9, 2013 9:50 AM, "Frank Hale" <[email protected]> wrote: >>> >>>> I'm trying to implement an interface that has properties but can't >>>> quite seem to get it to work and I also have not found any relevant >>>> examples via Google (yet). I'm sure I'm doing something completely wrong >>>> here but have no idea how to fix it. >>>> >>>> (System.Reflection.Assembly/LoadWithPartialName "System.Web") >>>> >>>> (defn foo-handler [] >>>> (reify System.Web.IHttpHandler >>>> (IsReusable [] false) >>>> (ProcessRequest [context] ()))) >>>> >>>> IsReusable is a property and I don't know how to tell reify that it is >>>> not a traditional function. >>>> >>>> CompilerException clojure.lang.CljCompiler.Ast.ParseException: Must >>>> supply at least one argument for 'this' in: IsReusable >>>> >>>> Okay, I supply 'this' for IsReusable >>>> >>>> CompilerException clojure.lang.CljCompiler.Ast.ParseException: Can't >>>> define method not in interfaces: IsReusable >>>> >>>> >>>> -- >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Clojure" group. >>>> To post to this group, send email to [email protected] >>>> Note that posts from new members are moderated - please be patient with >>>> your first post. >>>> To unsubscribe from this group, send email to >>>> [email protected] >>>> For more options, visit this group at >>>> http://groups.google.com/group/clojure?hl=en >>>> --- >>>> You received this message because you are subscribed to the Google >>>> Groups "Clojure" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>>> For more options, visit https://groups.google.com/groups/opt_out. >>>> >>> -- >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Clojure" group. >>> To post to this group, send email to [email protected] >>> Note that posts from new members are moderated - please be patient with >>> your first post. >>> To unsubscribe from this group, send email to >>> [email protected] >>> For more options, visit this group at >>> http://groups.google.com/group/clojure?hl=en >>> --- >>> You received this message because you are subscribed to the Google >>> Groups "Clojure" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> For more options, visit https://groups.google.com/groups/opt_out. >>> >> >> > -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
