traits - scala auto convert functions / methods? -


i have got class many methods.

class c{ def f1(x:string,....):...=.. def f2(..)... . . .  } 

i want every method defined in class decorated trait of choice automatically. create tricky implicit ore decorates every method , perhaps returns instance of class decorated methods. perhaps wrapped or modified or something. can not describe more of way because dont know way. know way that?

methods not functions, although automatically lifted when pass them method requires function. see http://jim-mcbeath.blogspot.com/2009/05/scala-functions-vs-methods.html

if have functions:

class c {   val f1 = (x: string, ...) =>   val f2 = (...) =>   ... } 

and want them mix in trait, like:

class c {   val f1 = new functionn[string, ...] gaga {     def apply(s: string, ...) = ...   }   val f2 = new functionn[...] gaga { ... }   ... } 

the way can think of submit class scala-refactoring: http://scala-refactoring.org/


Comments

Popular posts from this blog

javascript - Iterate over array and calculate average values of array-parts -

iphone - Using nested NSDictionary with Picker -

objective c - Newbie question -multiple parameters -