News for hackers. Stuff that matters.
Re:.NET NanoFramework by jeremycarter on Saturday January 16, 2021 @05:01AM (#25801282)
What's the difference between micro framework and nano framework? Does nano have generics?
Re:.NET NanoFramework by mikequinlan on Saturday January 16, 2021 @08:04AM (#25801945)
nanoFramework is a fork of Micro Framework.

https://en.wikipedia.org/wiki/.NET_Micro_Framework#History

>On 23 January 2017, after numerous attempts to revive .NET Microframework project and bring it to community governance and a period of work "in the dark", a group of embedded systems developers publicly announced .NET nanoFramework as spin-off of .NET Micro Framework.

Re:.NET NanoFramework by bryancostanich on Saturday January 16, 2021 @03:47PM (#25805363)
It's just a rework of the .NET MicroFramework, so it does not have Generics or any of the other new goodies post .NET v1.0 that are not compiler sugar.

Check out [Meadow](https://www.wildernesslabs.co/), though. Has both Generics and F# support. :)

Re:.NET NanoFramework by gregoryl on Saturday January 16, 2021 @06:23AM (#25801579)
Isn't generics just a part of the compiler?
Re:.NET NanoFramework by ylyn on Saturday January 16, 2021 @06:25AM (#25801583)
No, .NET generics are real and are reified at runtime, unlike Java where generics are just some compile-time typechecking.
Re:.NET NanoFramework by miguelrochefort on Saturday January 16, 2021 @06:41AM (#25801646)
On platforms that don't allow runtime code generation, such as iOS, generics are actually compiled ahead of time.

It's reasonable to ask if the same is done with NanoFramework.

Re:.NET NanoFramework by gregoryl on Saturday January 16, 2021 @06:42AM (#25801652)
To clarify, I was under-educated on how generics work, rather than being this clever.
Re:.NET NanoFramework by sesm on Saturday January 16, 2021 @07:33AM (#25801836)
Does this imply that generics in Ocaml/Haskell are not real?
Re:.NET NanoFramework by SigmundA on Saturday January 16, 2021 @07:59AM (#25801923)
My understanding is it doesn't matter in Haskell since it lacks reflection, they are real because you can't reflect and see they have been type erased at runtime.

In C# and Java reflection is used extensively and the generics still exist in C# when reflecting they are gone in Java.

Re:.NET NanoFramework by sideeffffect on Saturday January 16, 2021 @07:55AM (#25801909)
"Generics" in Haskell are real, but they're not what is in the .NET lingo called reified. Just like Java does not monomorphise.

On the other hand, C#, F# or Rust monomorphise (have reified generics).

Re:.NET NanoFramework by DaiPlusPlus on Saturday January 16, 2021 @01:12PM (#25804036)
Are “monomorphism” and “reification” interchangeable terms though? Considering how .NET now has covariant/contravariant generics I wonder if it could be described as having “polymorphic” generics as opposed to monomorphic generics - (unrelated to OOP polymorphism, ofc).
Re:.NET NanoFramework by sideeffffect on Saturday January 16, 2021 @01:49PM (#25804346)
AFAIUI _monomorphisation_ and reification are interchangable.

That means, that if I have a polymorphic (generic) class `MyClassA<T>`, the compiler (regardless if it is JIT in the runtime as in C#, or AOT as in Rust) monomorphises (reifies) `MyClassA` for each instantiation of `T`. So `MyClassA<MyClassB>` and `MyClassA<MyClassC>` are distinct classes.

For this reason, co-/contra-variance in C# works only for interfaces. Type parameters in classes are invariant. `MyClassA<MyClassB>` and `MyClassA<MyClassC>` are distinct classes, neither sub-/super-class of the other, even if `MyClassB` were a subclass of `MyClassC`.