Well, I tried add condition statement in the multi-method and found it worked
very well, and here is my tiny view dispatch framework!:
type
Document = ref object of RootObj
text: string
Request = ref object of RootObj
reqMethod: string
method view(doc: Document, req: Request): string {.base.} =
if req.reqMethod=="GET":
return doc.text
let doc = Document(text: "Hello World!")
echo view(doc, Request(reqMethod: "GET"))
Run
- Does nim implement predicate dispatch? geohuz
- Re: Does nim implement predicate dispatch? LeuGim
- Re: Does nim implement predicate dispatch? geohuz
- Re: Does nim implement predicate dispatch? Araq
- Re: Does nim implement predicate dispatch? Arrrrrrrrr
- Re: Does nim implement predicate dispatc... geohuz
- Re: Does nim implement predicate dis... geohuz
- Re: Does nim implement predicate... mashingan
- Re: Does nim implement predicate... geohuz
- Re: Does nim implement predicate... alehander42
