Tech Off Post

Single Post Permalink

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

    stevo_ said:

    Is it even ON the wishlist? can you explain why somebody would want this vs the .net tuple class? regardless of source naming guidelines Tongue Out.. (having type arg a and paramter a is really needlessly complicated).. personally I think you have a over obsession with functional style code.


    C# isn't classically functional, so trying to treat it so is really pretty abusive and it shows with how you'd need to use it.. if you want to go nuts on functional style, why not just pick a language that is based on functional foundations like F#?


    Your efforts would be much more rewarding there.

    There are several things to consider. (The why is explained previously but see the end of this post as well (the questions)).


    Types are shared across languages, imperative or declarative. The discussion here is about the formulation of tuples in .Net, so it is really language agnostic in a sense, it just so happens that C# is quite close to the lingua franca of .Net, MSIL. It could've been VB too for that matter. F# has a succint syntax but I'm not very convinced its fundamentally more functional than C# for example, given that C# now has lambdas and "monadic syntax". Both F# and C# are hybrid imperative/declarative/object-oriented languages; and F# has had to adapt to this as the .Net Framework is object-oriented (one possible interpretation of the dot in dot net?). So I don't believe a resistance to functional style C# is that meaningful in the larger scheme of things.


    The experimental code provided here is just to show how tuples could be defined in a more "compositional" way. There is disagreement as to whether this is a good thing. That's good  and certainly does not discourage me from experimenting - I find this both educational and fun. C# or F#, it really doesn't make that much difference to me. Types are shared - the fundamental means of expression also.


    So you should refocus your attention to the semantics: are tuples as sequences helpful or harmful; are tuples as structs vs classes helpful or harmful; are a "recursive" definition of tuples more helpful than a flat definition?