scala - Can I add class fields dynamically using macros? -


i'm new scala macros, sorry if obvious question.

i wonder if following possible before dig in deeper.

let's have class named dynamicproperties

is possible add members class based on this?

val x: dynamicproperties = ... x.addproperty("foo", 1)  x.addproperty("bar", true) x.addproperty("baz", "yep") 

and have translated somehow class looks more or less?

class somename extends dynamicproperties {     val foo: int = 1    val bar: boolean = true    val baz: string: yep } 

i guess can done via reflection, want people use this, have auto complete when type x. fit did earlier using addproperty method. possible using scala marcos? want try implement it, know if going down dead end path or not.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -