On Sat, Aug 24, 2013 at 9:50 PM, Lindsey Kuper <[email protected]>wrote:
> On Fri, Aug 23, 2013 at 8:30 PM, Sebastian Sylvan > <[email protected]> wrote: > > I'm sure you've all seen it, but C# has something similar but a lot more > > powerful. Basically, it has support for allowing runtime resolution of > types > > if they are declared as having the "dynamic" type. But it's even better, > the > > specification for how that resolution happens is defined in a library. > This > > way you can work directly with dynamic values without having to cast them > > first (e.g. imagine just "dotting your way" through a JSON document and > > parse it on-demand). > > A more recent approach to this kind of thing is F# type providers > (http://msdn.microsoft.com/en-us/library/hh156509.aspx and, for > instance, http://fsharp.github.io/FSharp.Data/library/JsonProvider.html). > Although I'm not especially familiar with them, they seem relevant > and interesting. > > > I think they're partially non-overlapping approaches. Type providers is about providing static types to dynamic data. I.e. someone has to write down a schema. C# dynamic is about just dealing with dynamic data on the fly. E.g. you could just open up any old JSON doc and start accessing members. The two approaches are probably used for the same thing, much of the time, but there are occasions where you can't define a static type for something, so having an approach where you can do the runtime checks in a less verbose fashion is nice (which I don't think the F# type providers thing does). -- Sebastian Sylvan
_______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
