Item 117 of 137 Previous | Next

53
Vote

Generics support for MF

description

Provide support for generics types for .NET MF.
This support is particularly necessary when porting small projects or libraries from the desktop, where re-working the code is not prohibitive but re-testing is delicate.
Having generics would allow to skip most of the testing altogether thus allowing true interoperability.
Furthermore a source code could be shared by adding an existing desktop source using "add as a link" in Visual Studio. The directives #define/#if can adjust the differences between MicroFramework and desktop implementations.

Real use case example: exchanging data between a balance and the MF device
- write the source code for the desktop using the serial port
- the collected data from the balance will use for example List<T> to provide more robustness
- test the protocol implementation on the desktop
- create a new library MF project
- "add as link" the desktop source code in the MF project
- add required #define and #if/#endif as required (for example to fix "using" namespaces definitions)

No files are attached

comments

juliusfriedman wrote Apr 20 at 12:02 PM

Also I just realized that similar to how you can use IL to allow mathematica operations across double and integer types by modifying the DLL after compilation you can probably utilize reflection and or some type of indirection to perform the same operations in the MF.

http://www.codeproject.com/Articles/33617/Arithmetic-in-Generic-Classes-in-C

http://stackoverflow.com/questions/1251507/is-it-possible-to-call-value-type-operators-via-reflection

If we can't have generics then possibly also the addition of the Dynamic Type would be helpful for these types of scenarios inter alia.

rogihee wrote Apr 14 2011 at 6:35 PM

+1. I recently ported a project from desktop USB automotive device to embedded FEZ Cobra where I created a new micro project with "add as link" for the core "model". Not having generics for simple things as list<type> was the biggest hurdle to overcome.

staceyw wrote Mar 30 2011 at 2:06 PM

+1. Doing things like simple ports for things like Rx or Linq ports loose of a lot of luster when having to resort to Object.