Tech Off Post

Single Post Permalink

View Thread: Ideas for C# 5.0
  • User profile image

    exoteric said:
    GrantB said:

    There doesn't appear to be anything special about Go's notion of type equivalence beyond structural typing. C# has dynamic now, not sure the good folks want to go beyond that because dynamic allows you to apply the same programming pattern but in a less type-safe way. Another idea is to be able to coerce a type that structurally matches a different type into that type - a sort of structural cast.


    Love the idea behind persistent data structures.

    Would there be any value in this?


    void f(dynamic IFoo arg)



    (1) arg is of type dynamic

    (2) the compiler warns when arg is used in a way not compatible with IFoo

    (3) the compiler warns when an actual parameter does not implement method signatures isomorphic with IFoo

    (4) the IDE provide arg with IFoo intellisense