Live data from Hacker News

New in C# 10: Easier Lambda Expressions

dontcodetired.com

101–110 of 111 posts

Re: New in C# 10: Easier Lambda Expressions

#101
post #69

Earlier quoted context omitted.

Reflection does away the need to manually implement serializers. In a growing codebase where data models transform and references to those models begin to rot, that is incredibly useful.

That can be done with code generation at compile time. We don’t need to reflect at runtime for that.

Usability is worse, IMO.

Serialization libraries need to be decoupled from the records being serialized. These two things are compiled into different assemblies, and often written by different people.

Still possible to replace with compile time codegen, but the implementation gonna be complicated and fragile.

Re: New in C# 10: Easier Lambda Expressions

#102
post #90
post #89

Earlier quoted context omitted.

Haskell is held back by pushing category theory into their tutorials. Want to do IO? Great, first learn about monads.

That's not true and never has been. Want to do I/O? main = do putStrLn "Who are you?" name There. Do you really need to know something about monads to understand that example? No. Do you need to know how do syntax and the assignment operator <- works? Sure. But that has nothing to do with category theory. That's just syntax.

To be fair, once you get a compiler error you’ll at least need to know:

a. do notation is converted to haskell b. what the bind and return functions do, for IO

So you can figure out;

c. Why your types are not lining up

To understand Haskell in general you need to realise do, bind and return are generic and can be used for not just IO but say for Maybe, List etc.

Basically you need to know most practical things about monads!

I had a bad time writing Haskell do notation until I understood monads. I used to write imperative code, try =, try <-, always undo typing back to known working states etc. to try and magic the code into compiling.

Re: New in C# 10: Easier Lambda Expressions

#103

Earlier quoted context omitted.

What you see as innovation is just slow diffusion into mainstream, the last decade is basically 80s sml family. The funny .. or sad.. part is that the c#9 explicit ~verbose style would have been the only one accepted before. If you wrote implicitely typed variables people would get angry (I think there are many online articles about how java 9 `var` was bad)

> What you see as innovation is just slow diffusion into mainstream It can be both. Type inference isn't a brand-new idea, but it still takes work to diffuse it into mainstream, practical languages, especially retrofitting it onto existing languages that weren't designed for it. That still counts as innovation in my book.

Yeah fair point. I'm just a bit salty that a lot of people only see the late stage effect onto their language and might assume that it came out of a vacuum you know. Then they look at you weird with your scheme, sml and prologs. Alas

Re: New in C# 10: Easier Lambda Expressions

#104

Earlier quoted context omitted.

One could argue that this is better covered by IDE/tooling showing you inferred types / suggestions.

If the function is printed in a journal article, or you just use something like 'less' to look at the file all that information is not available. I find it kind of weird that we've normalized not being able to read the code outside of the proper program for it. Since those IDEs often cost money it starts to feel a bit like steps towards a walled garden to me, and I'm not sure its good for actual computer science.

Not sure I'd say the IDEs "often cost money" these days

Re: New in C# 10: Easier Lambda Expressions

#105
post #89

Earlier quoted context omitted.

Haskell has been quietly doing this since the 90s though. I guess being a research-first language it isn’t held back by trying to have mass appeal (eg to be C-like to be familiar)

Haskell is held back by pushing category theory into their tutorials. Want to do IO? Great, first learn about monads.

I’ve not seen much category theory in tutorials. I have seen it in some conference talks but they are aimed at people who want that, and you don’t need to watch those.

I’m doing a take 2 now of getting into Haskell again but ignoring advanced language features (unless forced on me by a library) and ignoring category theory. The goal this time is using Haskell to just build stuff.

Re: New in C# 10: Easier Lambda Expressions

#106
post #64

Earlier quoted context omitted.

Local inference is a gift sent from heaven, global inference not so much. Reading OCAML (and F#) is exhausting because you have to look into the implementation of each function (or into a separate interface file) to figure out how it's supposed to be called and what it is going to return.

My IDE puts annotations on every function and I can hover over values. Typing them out seems pointless with the right tooling.

You can hover one thing at a time, you can skim a page with your eyes very quickly. Making important information cumbersome to access is a terrible idea.

Re: New in C# 10: Easier Lambda Expressions

#107
post #63

Earlier quoted context omitted.

Ever since LINQ, maybe even before that, I feel Java is a more boring C# clone. C# keeps innovating their language (borrowing a lot of times from other languages, of course), and then java seems to look and wait and do a half-assed implementation of a lot of tried-and-true C# language features some years later. Java had two tech advantages over C#: It officially ran on platforms other than Windows and ran well, and t…

Had Oracle not bought Sun, Java would have died in version 6, and MaximeVM would never had become GraalVM. There weren't other buyers in town, besides IBM, which I probably would have managed it just as Oracle has, given that the trio have been around in Java world since the early days.

Maybe, maybe not. Google was already heavily invested in java with Android. And lots of other places were too. If Oracle hadn't bought it, Google or one of the others might have bought java specifically from Sun. Or may have just let java die and be reborn as an "open source foundation" as they are en vogue now (which to some degree happened anyway, with the proliferation of the OpenJDK).

Re: New in C# 10: Easier Lambda Expressions

#108
post #90

Earlier quoted context omitted.

That's not true and never has been. Want to do I/O? main = do putStrLn "Who are you?" name There. Do you really need to know something about monads to understand that example? No. Do you need to know how do syntax and the assignment operator <- works? Sure. But that has nothing to do with category theory. That's just syntax.

To be fair, once you get a compiler error you’ll at least need to know: a. do notation is converted to haskell b. what the bind and return functions do, for IO So you can figure out; c. Why your types are not lining up To understand Haskell in general you need to realise do, bind and return are generic and can be used for not just IO but say for Maybe, List etc. Basically you need to know most practical things about…

That's a good point. It was long enough since I learned this stuff that I mentally translate "Monad m => m a" into "IO String" for example in type errors, to the point of not even noticing how cryptic the generic types can be!

Re: New in C# 10: Easier Lambda Expressions

#109
post #63

Earlier quoted context omitted.

Had Oracle not bought Sun, Java would have died in version 6, and MaximeVM would never had become GraalVM. There weren't other buyers in town, besides IBM, which I probably would have managed it just as Oracle has, given that the trio have been around in Java world since the early days.

Maybe, maybe not. Google was already heavily invested in java with Android. And lots of other places were too. If Oracle hadn't bought it, Google or one of the others might have bought java specifically from Sun. Or may have just let java die and be reborn as an "open source foundation" as they are en vogue now (which to some degree happened anyway, with the proliferation of the OpenJDK).

OpenJDK is developed 90% by Oracle employees, others just take it from there, there is no proliferation .

Re: New in C# 10: Easier Lambda Expressions

#110

Earlier quoted context omitted.

If the function is printed in a journal article, or you just use something like 'less' to look at the file all that information is not available. I find it kind of weird that we've normalized not being able to read the code outside of the proper program for it. Since those IDEs often cost money it starts to feel a bit like steps towards a walled garden to me, and I'm not sure its good for actual computer science.

Not sure I'd say the IDEs "often cost money" these days

Wait for VSCode Enterprise.
Post reply on HN